Java Main Differences between Java and C++
转载自: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
llvmwhich 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.
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
Java Main Differences between Java and C++的更多相关文章
- Java Main Differences between HashMap and HashTable
转自这篇帖子:http://www.importnew.com/7010.html HashMap和Hashtable的比较是Java面试中的常见问题,用来考验程序员是否能够正确使用集合类以及是否可以 ...
- Java Main Differences between HashMap HashTable and ConcurrentHashMap
转自这篇帖子:http://www.importnew.com/7010.html HashMap和Hashtable的比较是Java面试中的常见问题,用来考验程序员是否能够正确使用集合类以及是否可以 ...
- 利用Java Service Wrapper将java项目添加到windows服务中
1.web项目,即tomcat/resin添加至window系统服务,步骤如下:第一步:找到tomcat的bin目录,如:D:\apache-tomcat-8.0.26\bin第二步:打开cmd,cd ...
- The differences between Java application and Java applet
在Java语言中,能够独立运行的程序称为Java应用程序(Application).Java语言还有另外一种程序--Applet程序.Applet程序(也称Java小程序)是运行于各种网页文件中,用于 ...
- The differences between Java EE components and "standard" Java classes
https://docs.oracle.com/javaee/7/tutorial/overview003.htm ava EE components are written in the Java ...
- 10个经典的Java main 方法面试题
1. 不用main方法如何定义一个类? 不行,没有main方法不能运行Java类. 在Java 7之前,你可以通过使用静态初始化运行Java类.但是,从Java 7 开始就不行了. 2. main() ...
- 07 java main方法
1.问题:Java main方法为什么是 public static void main(String[] args)??? 序号 场景 编译 运行 解释 1 public修改为private pr ...
- java main()静态方法
java main()方法是静态的.意味着不需要new(),就在内存中存在.而且是属于类的,但是对象还是可以调用的. 若干个包含这个静态属性和方法的对象引用都可以指向这个内存区域.这个内存区域发生改变 ...
- [转] 使用maven运行java main的三种方式
原文地址: http://blog.csdn.net/qbg19881206/article/details/19850857?utm_source=tuicool&utm_medium=re ...
随机推荐
- 转载:hdu 动态规划题集
1.Robberies 连接 :http://acm.hdu.edu.cn/showproblem.php?pid=2955 背包;第一次做的时候把概率当做背包(放大100000倍化为整数): ...
- dig 命令详解(转载) - 阿权的书房
在 unix 和 linux 下,建议大家使用 dig 命令来代替 nslookup. dig 命令的功能比 nslookup 强大很多,不像 nslookkup 还得 set 来 set 去的,怪麻 ...
- jquery CDN(内容分发网络)使用
jquery CDN 给开发者提供一种捷径,即不下载jquary 就通过CDN能使用各个版本的jquery. 使用方法很简单,就是在HTML 文档中引用相关版本的jquery. 例如:我用百度的CDN ...
- Git学习记录
一.简要说明 Git是分布式版本控制系统,而非集中式版本控制系统.其优势如下: 自由和开放源码 速度快,体积小 隐式备份(每台用户机上都有一个备份) 安全 不需要强大的硬件 更简单的分支 二.基本概念 ...
- Apache Spark源码走读之12 -- Hive on Spark运行环境搭建
欢迎转载,转载请注明出处,徽沪一郎. 楔子 Hive是基于Hadoop的开源数据仓库工具,提供了类似于SQL的HiveQL语言,使得上层的数据分析人员不用知道太多MapReduce的知识就能对存储于H ...
- unity中Debug输出控制
1 需求: (1)选择在界面.console中输出,并且能够设置保存到文档 (2)控制debug是否输出,可以在debug模式下输出,release模式下不输出 2 参考: 谢谢雨松同学的博客:htt ...
- 使用scrapy爬取网站的商品数据
目标是爬取网站http://www.muyingzhijia.com/上全部的商品数据信息,包括商品的一级类别,二级类别,商品title,品牌,价格. 搜索了一下,python的scrapy是一个不错 ...
- 【转】【DP_树形DP专辑】【9月9最新更新】【from zeroclock's blog】
树,一种十分优美的数据结构,因为它本身就具有的递归性,所以它和子树见能相互传递很多信息,还因为它作为被限制的图在上面可进行的操作更多,所以各种用于不同地方的树都出现了,二叉树.三叉树.静态搜索树.AV ...
- iOS开发-VFL(Visual format language)和Autolayout
AutoLayout不管是在StoryBorad还是在xib中都相对来说比较简单,VFL(Visual fromat language)可视化语言基本上用到的比较少,在xCode4时候自动布局的概 ...
- Python之创建tuple和“可变”的tuple
Python之创建tuple tuple是另一种有序的列表,中文翻译为" 元组 ".tuple 和 list 非常类似,但是,tuple一旦创建完毕,就不能修改了. 同样是表示班里 ...