Solved

difference between Java and C++

Posted on 2011-02-28
7
805 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

726 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