Java Main Differences between Java and C++
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Java Main Differences between Java and C++,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3171字,纯文字阅读大概需要5分钟。
内容图文
![Java Main Differences between Java and C++](/upload/InfoBanner/zyjiaocheng/1067/80168896ffe14f3c994b0d28653ffb73.jpg)
转载自:http://www.cnblogs.com/springfor/p/4036739.html
-
C++ supports pointers whereas Java does not. 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 for
llvm
which 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/#ifndef
type). -
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
import
to 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
goto
statement 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.
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
原文:http://www.cnblogs.com/Dylan-Java-NYC/p/4855307.html
内容总结
以上是互联网集市为您收集整理的Java Main Differences between Java and C++全部内容,希望文章能够帮你解决Java Main Differences between Java and C++所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。