?
Solved

difference between Java and C++

Posted on 2011-02-28
7
Medium Priority
?
812 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 1600 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 1600 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
Independent Software Vendors: 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 400 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

864 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