Difference between Java and C++?

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
hmm, well, more than anything the ability to be able to use your java program across any platform.



c++ is a bit more a "windows" language like VB. although jave is not necessarily a linux language either but C is .





dam(am i making sense?)
 

MJT2k

Senior member
May 28, 2001
209
0
0
From what I know and have heard from a programming instructor is that Java is a true cross platform language. Which means write the code once and compile on any platform and it works, providing there are no errors in the code. Jave was also created in c or c++ (don't remember which off hand, but leaning towards c++ because Java and c++ are both object oriented). Java is also the langauge for the Internet.
 

iamwiz82

Lifer
Jan 10, 2001
30,772
13
81
java can be compiled on most platforms. IE: i can write a program in my room and telnet it to the school's unix server and run the same program there with no problems.
 

StageLeft

No Lifer
Sep 29, 2000
70,150
5
0
Java is also slower than C++ because of the ...damn whats that thing called that interprets the Java code between the Operating system? Real time interpreter or some crap. In fact Java is a LOT slower than C++!

EDIT: Java virtual machine!
 

gittyup

Diamond Member
Nov 7, 2000
5,036
0
0
Java cleans up memory for you, whereas C++ burdens the programer with the task. ;)
 

MJT2k

Senior member
May 28, 2001
209
0
0
Now isn't JVM a MS thing. Isn't the "real" Jave from Sun faster??
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
There are *many* differences between Java and C++, at both the high and low levels.

Since I couldn't iterate them all in a short post, I suggest picking up a book, or reading an article online as this discussion has been made many times.
 

nd

Golden Member
Oct 9, 1999
1,690
0
0


<< c++ is a bit more a &quot;windows&quot; language like VB. although jave is not necessarily a linux language either but C is . >>

Well, not quite. C++ isn't a &quot;windows&quot; language at all like VB -- Visual Basic is a complete fabrication of Microsoft. It's a GUI and application builder for Win32 specifically, and is based on a language pretty much owned by Microsoft.

ANSI C++ programs will compile to any platform with a decent C++ compiler. C++ has nothing to do with Windows, as it is just a language. C isn't a Linux language either. Sure, Linux is written in C, along with 90% of the code written around it.. but C came way before Linux (it was invented for the original UNIX).

To answer the question at hand, Java is a stripped down C++ with high-level features like automatic garbage collection so the programmer doesn't have to manage their own memory. Java is intended to be cross-platform at the binary level, and consequently compiles to byte-code binaries instead of true executables (like a C++ compiler will produce). The result is that the Java program will be (in general) more secure, less prone to error, but will also be much slower than a natively compiled C++ application (assuming same algorithms are used). You can usually write an application in Java in a shorter period of time than you could in C++ as well. A JVM (Java Virtual Machine) is used to execute the compiled bytecode.