The main difference between Java & C++(转载)
转载自:http://stackoverflow.com/questions/9192309/the-main-difference-between-java-c
C++ supports pointers whereas Java does not pointers. But when
many programmers questioned how you can work without pointers, the
promoters began saying "Restricted pointers.” So we can say java
supports Restricted pointers.At compilation time Java Source code converts into byte code .The
interpreter execute this byte code at run time and gives output. Java
is interpreted for the most part and hence platform independent (Write
once, run anywhere). C++ run and compile using compiler which converts
source code into machine level languages so c++ is platform dependent
(Write once, compile anywhere).Java is platform independent language but c++ is dependent upon
operating system machine etc. C++ source can be platform independent
(and can work on a lot more, especially embedded, platforms), although
the generated objects are generally platform dependent but there is
clang forllvmwhich doesn't have this restriction.Java uses both a compiler and interpreter, while C++ only uses a compiler
C++ supports operator overloading multiple inheritance but java does not.
C++ is nearer to hardware then Java
Everything (except fundamental types) is an object in Java (Single root hierarchy as everything gets derived from
java.lang.Object).Java does is similar to C++ but it doesn't have the complicated
aspects of C++, such as pointers, templates, unions, operator
overloading, structures, etc. Java also does not support conditional
compilation (#ifdef/#ifndeftype).Thread support is built into Java but not in C++. C++11, the most
recent iteration of the C++ programming language, does have Thread
support though.Internet support is built into Java, but not in C++. On the other
hand, C++ has support for socket programming which can be used.Java does not support header files and library files. Java uses
importto include different classes and methods.Java does not support default arguments.
There is no scope resolution operator
::in Java. It has.using which we can qualify classes with the namespace they came from.There is no
gotostatement in Java.Because of the lack of destructors in Java, exception and auto garbage collector handling is different than C++.
Java has method overloading, but no operator overloading unlike C++.
The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion,
Java does not support unsigned integers.
以下转载自:http://geeksquiz.com/c-features-missing-java/
Following features of C++ are not there in Java.
No pointers
No sizeof operator
No scope resolution operator
Local variables in functions cannot be static
No Multiple Inheritance
No Operator Overloading
No preprocessor and macros
No user suggested inline functions
No goto
No default arguments
No unsigned int in Java
No -> operator in java
No stack allocated objects in java
No delete operator in java due to java’s garbage collection
No destructor in java
No typedef in java
No global variables, no global function because java is pure OO.
No friend functions
No friend classes
No templates in java
The main difference between Java & C++(转载)的更多相关文章
- 如何用javac 和java 编译运行整个Java工程 (转载)【转】在Linux下编译与执行Java程序
如何用javac 和java 编译运行整个Java工程 (转载) http://blog.csdn.net/huagong_adu/article/details/6929817 [转]在Linux ...
- JMeter学习(十五)JMeter测试Java(转载)
转载自 http://www.cnblogs.com/yangxia-test 目的:对Java程序进行测试 目录 一.核心步骤 二.实例 三.JMeter Java Sampler介绍 四.自带Ja ...
- Java 正则表达式[转载]
PS:转载自CSDN博客看上去很美 众所周知,在程序开发中,难免会遇到需要匹配.查找.替换.判断字符串的情况发生,而这些情况有时又比较复杂,如果用纯编码方式解决,往往会浪费程序员的时间及精力.因此,学 ...
- Java Main Differences between Java and C++
转载自:http://www.cnblogs.com/springfor/p/4036739.html C++ supports pointers whereas Java does not. But ...
- Java NIO 转载
原文:http://www.iteye.com/magazines/132-Java-NIO Java NIO 系列教程 2014-04-28 编辑 wangguo 评论(71条) 有204256 ...
- Eclipse下执行main函数报java.lang.NoClassDefFoundError的解决
今天执行eclipse下的一个java类,无论run还是debug,都报java.lang.NoClassDefFoundError.而且把main中函数都注释掉,执行还是报一样的错. 检查了一下这个 ...
- 详细分析Java中断机制-转载
1. 引言 当我们点击某个杀毒软件的取消按钮来停止查杀病毒时,当我们在控制台敲入quit命令以结束某个后台服务时……都需要通过一个线程去取消另一个线程正在执行的任务.Java没有提供一种安全直接的方法 ...
- 在命令行中直接运行带main方法的java
用了很久的java,基本都是交给服务器完成的执行,有page之类的入口,或者是在IDE工具中直接 Run As Java Application. 并且一直对安装java之后配置JAVA_HOME,p ...
- PTA Java tips(转载)
在PTA提交Java程序需要注意如下几个要点 1. Main类与Scanner 1.1 Main类 你提交的所有程序都应该以如下形式出现 public class Main{ public stati ...
随机推荐
- NDK开发总结
NDK开发差不多结束了, 估计后面也不会再碰了诶, 想着还是写个总结什么的,以后捡起来也方便哈.既然是总结,我这里就不会谈具体的细节,只会记录下我觉得重要的东西, 所以这篇随笔不是为萌新学习新知识准备 ...
- Bootstrap 基础学习笔记(一)
排版 (1)标题 Bootstrap标题样式进行了以下显著的优化重置: 1.重新设置了margin-top和margin-bottom的值, h1~h3重置后的值都是20px:h4~h6重置后的值都 ...
- Big Number--hdu1018(数学)
http://acm.hdu.edu.cn/showproblem.php?pid=1018 题目大意 : 求一个数的阶乘的位数 公式log10(n!)=log10(1)+log10(2)+log1 ...
- hd2066一个人的旅行
Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰 ...
- 【转】python fabric实现远程操作和部署
fabric title是开发,但是同时要干开发测试还有运维的活……为毛 task*3 不是 salary * 3 (o(╯□╰)o) 近期接手越来越多的东西,发布和运维的工作相当机械,加上频率还蛮高 ...
- BufferedOutputStream的学习
今天写了一下一段代码,结果打开文件却发现要写入文件的内容不仅没写入,原来的内容也消失了,而控制台却显示原文件的内容都被读取出来了,代码如下: FileInputStream fileInputStre ...
- border-radius(边框半径)
可以使用像素来指定border-radius的属性值使角变圆 除了像素,你还可以使用百分比来指定border-radius边框半径的值
- SVEditor 1.3.6 发布
SVEditor 1.3.6 支持代码高亮时没有处理 #ifdefs 语句的问题,支持类.接口.模块.任务和函数的代码折叠,修复了一些 bug. SVEditor 是一个Eclipse的插件,用来编辑 ...
- 从“程序员转行卖烧饼”想到IT人创业
我的一个朋友最近总在跟我念叨着“我不想做开发了,整天累死累活写程序,也攒不下几个钱.我想辞职搞点啥!” 我问他:“你想搞点啥?”. 他说:“搞啥都比做开发强,做个网站赚广告费,接私活……实在不行我去卖 ...
- Python time datetime常用时间处理方法
常用时间转换及处理函数: import datetime # 获取当前时间 d1 = datetime.datetime.now() print d1 # 当前时间加上半小时 d2 = d1 + da ...