Solved

difference between Java and C++

Posted on 2011-02-28
7
798 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum5 challenge 5 71
eclipse package explorer vs project explorer view 2 84
Java SE 8u111  Lot of stuff broke 11 54
windows explorer path to command prompt 5 33
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now