Solved

difference between Java and C++

Posted on 2011-02-28
7
803 Views
Last Modified: 2012-05-11
I am currently learning Java and I already know  C++.  the book I am reading said Java  is missing some of the harder components of C++.  Does anyone know what these are?  I might not know how to use them in C++ either but I'd like to know what they are.
0
Comment
Question by:dwcronin
  • 4
  • 2
7 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 400 total points
ID: 35003476
One thing which is often mentione is that Java does not support
operator oveerloading supported by C++ - this is the feature which allows
to provide special menaing to such oprators as +, -, etc, within certain classes
These sometimes make reading C++ program difficult

The most obvious thing is that Java does not support pointers - they may also sometimes
be difficult to understand.

Also java requires all code to be within classes. In C++ you may have codes
outside any classes. In this way Java becomes
more organized.  

Therefore it is easier to understand Java code, on the other hand C++
can be more flexible.

Of course one can find some papers about the differences; these are just thisng which come
up perhaps most often.



0
 
LVL 47

Expert Comment

by:for_yan
ID: 35003481


There is below sectooion C++ concepts missing in Java;
http://www4.ncsu.edu/~kaltofen/courses/Languages/JavaExamples/cpp_vs_java/
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 400 total points
ID: 35003487
Yes, also important thing which makes java easier - is that it does not allow multiple inheritance -
class can  have only one superclass
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 35003493
And this page also has a few interesting points on this subject from the point of view of C++ programmers:
 
http://www.programmersheaven.com/mb/CandCPP/237865/237875/re-from-c++-to-java/?S=B20000
0
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 100 total points
ID: 35003514
Java's garbage collection removes the memory leak issue to a large degree.
Java does not support multiple inheritance which can cause problems if not careful. Instead, they emulate the C++ abstract class interface.
Java does not support pointers or pointer arithmetic, which is often tricky to use in C++ (although convenient).
Java's code is more portable than C++ code. Unfortunately, there are so many releases of Java per decade that a currently built program may not run on an older JVM.

Here is a list of differences:
   http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B

0
 
LVL 32

Expert Comment

by:phoffric
ID: 35003520
I didn't see any previous posts, so there appears to be repetition.
0
 

Author Closing Comment

by:dwcronin
ID: 35003550
thank all of you.  You guys were very fast!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jsp login check 12 52
java imports not found 4 47
restrict decimal places for double datatype 10 29
Java List 4 32
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question