The main difference between Java&C++

3704 ワード

転載元:http://stackoverflow.com/questions/9192309/the-main-difference-between-java-c
 
  • C++supports pointers.Java does not pointers.But when many programmers questiond how You can work without pointers,the promoters began saying“Resticted pointers.”So can sant.japt.java。
  • At copilation 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 plot form indenterC++run and comppile using compler which converts source code into machine level langage so c+is plotform dependent(Write once、comple anywhere).
  • Java is plotform independent langage but c+is dependent up on operate system machine etc.C++source can be plotform independent(and can work on a lot more、especially embedded、plot)although the generant object are general plotform dependent but there is clang for llvm which doesn't have this retriction.
  • Java uses both a compler and interpreter、while C++only uses a compler
  • C++supports operatooverloading multiple inherityance but java does not.
  • C++is nearr to handware then Java
  • Everything(except fundenmental types)is an object in Java(Single root hierarchy as everrything gets ders from java.lang.Object).
  • Java does is simiar to C++but it doesn't have the compplicated aspects of C+,such as pointers,templates,unions,operatooverloading,stuctures,etc.Java also does not supportion 24。
  • Thread support is built into Java but not in C+.C+11,the most recent iteration of the C+programming lagage,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.Java uses #ifdef/#ifndef to include different clases and methods.
  • Java does not support default argments.
  • The e isのscope resolution operator import in Java.It has :: using which we can qualify classis with the namespace the came from.
  • The re isの. statement in Java.
  • Because of the lack of destructors in Java,exception and aut garbage collector handing is different than C+.
  • Java has method overloading、butのoperator overloading unlike C+.
  • The String class does use the+and=operators to concatens string and String expressitions use atomatic type conversion,
  • Java is pass-by-value.
  • Java does not support unsigned integers.
  •  以下の転載は以下の通りですhttp://geeksquiz.com/c-features-missing-java/
    Following feature s of C++are not there in Java.
    No pointers No size of operator No scope resolution operator Local variables in functions cannot be static No Multile Inherityance No Operator Overloading No preprocessor and macros No user suggated inline functions No goto No default argments No No No No No No.ned in t in Java No.operator java No.ypeef in java No global variables,no global function because java is pure OO.No friend functions No friend clases No templates in java