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
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
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 ...
随机推荐
- 提升 web 应用程序的性能(一)
提升 web 应用程序的性能,找出瓶颈,加快客户端内容的速度. 作为 web 用户,我们知道页面加载或刷新的速度对其成功至关重要.本文将帮助您更好地理解影响 web 应用程序性能的因素.学 ...
- mac 下的 top 命令
mac 下的 top 命令 文章目录 以前只是在 linux 机器上使用 top 命令.常用的快键键是: p 键 - 按 cpu 使用率排序 m 键 - 按内存使用量排序 这 2 个快捷键在 mac ...
- stack, deque 和 queue的对比
stack, deque 和 queue这三个c++的STL的数据结构很类似但又各有不同. stack是堆栈,没有迭代器,特点是后进先出.用push()将元素压入栈中,top()返回栈顶元素,pop( ...
- lvs原理和实战
lvs-dr原理 lvs-nat原理: 当我们的网站流量越来越大时一台web服务器已经无法满足需求了,我们该如何解决呢??把服务器连接起来实现负载均衡或许是个不错的办法..下面我就来看看怎么实现吧 ...
- Scrum会议5
组名称:天天向上 项目名称:连连看 参会成员:王森(Master)张金生 张政 栾骄阳 时间:2016.10.20 已完成内容: 1.游戏中实现了两个按钮消除的算法. 2.在游戏中加入了音乐. 计划完 ...
- DS实验题 Old_Driver UnionFindSet结构 指针实现邻接表存储
题目见前文:DS实验题 Old_Driver UnionFindSet结构 这里使用邻接表存储敌人之间的关系,邻接表用指针实现: // // main.cpp // Old_Driver3 // // ...
- 解决mysql出现“the table is full”的问题
解决mysql出现“the table is full”的问题 2010-12-20 09:15:17 分类: LINUX 今天中午收到mysql错误日志监控发来的警报,错误日志如下: 101209 ...
- HTML: 字符實體
在HTML編寫中,有些字符不適合直接在代碼中寫出,比如>,<, (space空格),",',&等等,這時我們按照一定的格式將它們寫出,比如(大於)> 符號,我們用 ...
- Bootstrap页面布局17 - BS选项卡
代码结构: <div class='container-fluid'> <h2 class='page-header'>Bootstrap 选项卡</h2> < ...
- 时间函数 date strtotime
date_default_timezone_set('Asia/Shanghai');echo strtotime('Today');echo strtotime(date('Y-m-d')); 获取 ...