转载自:http://stackoverflow.com/questions/9192309/the-main-difference-between-java-c

  1. 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.

  2. 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).

  3. 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.

  4. Java uses both a compiler and interpreter, while C++ only uses a compiler

  5. C++ supports operator overloading multiple inheritance but java does not.

  6. C++ is nearer to hardware then Java

  7. Everything (except fundamental types) is an object in Java (Single root hierarchy as everything gets derived from java.lang.Object).

  8. 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).

  9. 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.

  10. Internet support is built into Java, but not in C++. On the other
    hand, C++ has support for socket programming which can be used.

  11. Java does not support header files and library files. Java uses import to include different classes and methods.

  12. Java does not support default arguments.

  13. There is no scope resolution operator :: in Java. It has . using which we can qualify classes with the namespace they came from.

  14. There is no goto statement in Java.

  15. Because of the lack of destructors in Java, exception and auto garbage collector handling is different than C++.

  16. Java has method overloading, but no operator overloading unlike C++.

  17. The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion,

  18. Java is pass-by-value.

  19. 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++(转载)的更多相关文章

  1. 如何用javac 和java 编译运行整个Java工程 (转载)【转】在Linux下编译与执行Java程序

    如何用javac 和java 编译运行整个Java工程 (转载)  http://blog.csdn.net/huagong_adu/article/details/6929817 [转]在Linux ...

  2. JMeter学习(十五)JMeter测试Java(转载)

    转载自 http://www.cnblogs.com/yangxia-test 目的:对Java程序进行测试 目录 一.核心步骤 二.实例 三.JMeter Java Sampler介绍 四.自带Ja ...

  3. Java 正则表达式[转载]

    PS:转载自CSDN博客看上去很美 众所周知,在程序开发中,难免会遇到需要匹配.查找.替换.判断字符串的情况发生,而这些情况有时又比较复杂,如果用纯编码方式解决,往往会浪费程序员的时间及精力.因此,学 ...

  4. Java Main Differences between Java and C++

    转载自:http://www.cnblogs.com/springfor/p/4036739.html C++ supports pointers whereas Java does not. But ...

  5. Java NIO 转载

    原文:http://www.iteye.com/magazines/132-Java-NIO  Java NIO 系列教程 2014-04-28  编辑 wangguo 评论(71条) 有204256 ...

  6. Eclipse下执行main函数报java.lang.NoClassDefFoundError的解决

    今天执行eclipse下的一个java类,无论run还是debug,都报java.lang.NoClassDefFoundError.而且把main中函数都注释掉,执行还是报一样的错. 检查了一下这个 ...

  7. 详细分析Java中断机制-转载

    1. 引言 当我们点击某个杀毒软件的取消按钮来停止查杀病毒时,当我们在控制台敲入quit命令以结束某个后台服务时……都需要通过一个线程去取消另一个线程正在执行的任务.Java没有提供一种安全直接的方法 ...

  8. 在命令行中直接运行带main方法的java

    用了很久的java,基本都是交给服务器完成的执行,有page之类的入口,或者是在IDE工具中直接 Run As Java Application. 并且一直对安装java之后配置JAVA_HOME,p ...

  9. PTA Java tips(转载)

    在PTA提交Java程序需要注意如下几个要点 1. Main类与Scanner 1.1 Main类 你提交的所有程序都应该以如下形式出现 public class Main{ public stati ...

随机推荐

  1. xcode 制作静态库.a文件 详解

    http://blog.csdn.net/kepoon/article/details/21516977 最近在做Apple的IOS开发,有开发静态库的需求,本身IOS的开发,只允许静态库或者Fram ...

  2. 深入浅出Symfony2 - 如何提高网站响应速度 [转]

    简介 Symfony2是一个基于PHP语言的Web开发框架,有着开发速度快.性能高等特点.但Symfony2的学习曲线也比较陡峭,没有经验的初学者往往需要一些练习才能掌握其特性.相对其他框架,Symf ...

  3. IOS s数据存储之归档解档

    #import <Foundation/Foundation.h> @interface Student : NSObject <NSCoding>; @property(no ...

  4. android设置多个类似APP其中的一个为默认

    05-09 17:01:13.547: I/ActivityManager(3003): START u0 {act=android.intent.action.VIEW cat=[android.i ...

  5. Ubuntu下修改hosts文件

    Ubuntu系统的Hosts只需修改/etc/hosts文件,修改完之后要重启网络.具体过程如下:1.修改hostssudo gedit /etc/hosts2.添加解析记录( . )或者从githu ...

  6. 9月15日,YTFCloud,创业圈的技术新宠

    成都创业圈近期什么最热? 资本复苏?这本来就是高低起伏规律而已,再说动辄千万的大手笔,对于创业新人.新团队来说太遥远,早期根本无法变现,而资金紧张.项目开发费用超标.没有技术大牛保障等尖锐现实问题能否 ...

  7. 【Visual Lisp】变体与安全数组

    (vlax-make-variant) ;;创建一个未初始化的变体 ;;01.整型值变体(setq myvar (vlax-make-variant 10)) ;;创建整型值变体,返回 #<va ...

  8. 关于.net 中Clipboard.GetDataObject() 之后读出数据读出的数据都是相同的解决方法

    模拟键盘sendkey("^c") 多次复制之后 当使用Clipboard.GetDataObject() 读出数据都是一个值 经过多次尝试 提供一个解决方案 IDataObjec ...

  9. Yii中设置时间分区

    在wamp环境下,运行一个Php yii的项目 出现问题: Use of undefined constant PRC - assumed 'PRC' 检测我的环境 PHP5.3 检测Php.ini中 ...

  10. 用sass画蜗牛

    一.sass的好处 用css画图也算是简单的实战吧,虽然用到的东西还比较少..用过之后,发现sass主要有以下优势: 可维护性.最重要的一点,可维护性的很大一部分来自变量 嗯,最简单的例子,画图总要有 ...