What are the differences between c++ and java?

Showing Answers 1 - 6 of 6 Answers

simon

  • Aug 29th, 2006
 

In c++ we have pointers but in java we don't use pointers and java is platform independent

  Was this answer useful?  Yes

Tusar Patel

  • Nov 27th, 2006
 

Well there are many difference between C++ and Java.Some of them are as follows....

1.C++ have pointer.Pointer concept is not present in java.

2.C++ directly can get multiple inheritance but in case of java u need interface concept to acheive multiple inheritance.

3.In C++, object are passed as values, where as in java object are passed as reference.

4.There are no goto and global variable in java.

5.Java do not have destructors where as these are present in C++.

6. There are no " freindly" access specifier in java.In java it is default.In C++ we need to mention as freindly

7.Garbage Collector concept is not there in C++.

  Was this answer useful?  Yes

Additional pts

1)Java has interfaces as well! there is no such concept in C++
2)Packages are very hande in java
3)C++ is much faster than java
4)Exception handling is easier in java
5)class inc ++ by default Private
 here in java by default : no modifier
6)threading very imp and useful concept introduced in java
7)better graphical interface in java

  Was this answer useful?  Yes

sathya

  • Mar 25th, 2007
 

C++
Iterators are members of classes. The start of a range is .begin(), and the end is .end(). Advance using ++ operator, and access using *.
Protection levels (abstraction barriers):public:
        void foo();
        void bar();

java
Iterator is just an interface. The start of the range is <collection>.iterator, and you check to see if you're at the end with itr.hasNext(). You get the next element using itr.next() (a combination of using ++ and * in C++).

Protection levels (abstraction barriers):
public void foo();
    public void bar();

  Was this answer useful?  Yes

1:c++ support pointers and java does not support poniters bcoz poniter means which hold the adress of anotherr pointer...virus will spread through pointers
2:c++ support multiple inhertetance but java does support multp inher...
3:c++ does requirejvm to run but java reqiure jvm to complie...
4:c++ does not support script language but java supports...
5:c++ uses header files but java does not support header files..
6:c++ can make use of operator overloading..but java does not support operator overloading

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions