Java and C++ are object oriented languages. C isn't. C and C++ are pre compiled so run fast on the machines they're designed for. Java isn't compiled until runtime, so runs very slow the first time used.
2006-08-11 20:43:59
·
answer #1
·
answered by Anonymous
·
0⤊
1⤋
They say that if you C, you already know a lot about Java. This is the case since the two program languages share similar primitive types (char,short,int,long,float,double), and syntax. However the two when compared with each other are quite different.
Some major differences are:
- Java is much more powerful, as it is an object-oriented programming (OOP) language, where as C is function oriented (similar to PASCAL).
- Java has built in error check which prevents errorous programming. In C, problems such as converting strings to integers, is still allowed to compile and execute, possibly creating critical errors during runtime. For the same reason, Java is easier to debug.
- Java uses classes, where as C is limited to functions.
- Java classes save programmers time since a large portion of code, in the form of classes, is already written and only need to be implemented to be used. C requires the programmer to program and debug each function themselves.
- Compiling C code creates machine code, compiling Java code creates bytecode that can be interperted by any platfrom with Java Virtual Machine. Thus Java is platform independent; C when compiled generates an executable, that is tailored to the platform it is compiled on.
- Security is embedded into the Java language making it very secure, where as C is limited.
- Java has automatic garbage collection. When an object is no longer needed or reference the memory allocated to such is automatically freed and made avaliable for usage. C requires manual memory management.
- Many data structures are already defined in Java, such as arrays, records, lists, etc. String is a data type in Java, in C you would need to create an array of chars.
- Java uses references rather than pointers and address operators.
- Java is supported and used on many devices: PDAs, cellphones, computers, printers, car devices etc. C's usage is limited.
Those are some of the major differences between the two languages. For more information try:
http://www.jazillian.com/reasons.html
http://www.cs.princeton.edu/introcs/faq/c2java.html
2006-08-11 21:19:53
·
answer #2
·
answered by tarotaro8 2
·
1⤊
0⤋
difference in what? syntax? usage? capability? or what?
In syntax:
There is little difference to both, mainly because Java is a language made specifically to resemble C since C is, at that time, one of the most widely used language, and thus makes transition between C and Java easier. However, a Java code is never guaranteed to ever compile with C compiler, and a C code is not guaranteed to ever compile with Java compiler, since Java's resemblance is not maintained all along, it's just made to be similar initially.
In deployment:
C programs is compiled to a native code, but Java program is compiled to intermediate language. C's compiled code means faster program but inability to cross-platform directly without recompilation. And Java's intermediate language means it is cross-platform directly without any recompilation, but is slow to run.
C programs is usually deployed as a normal program, but Java can have the option of deployed as a Internet program, embedded inside a webpage, and a normal program.
Capability:
The capability of both language is more or less the same, however C's capability is barebone, meaning, in a normal C package, only the most essential libraries and such is included, unlike Java's powerful libraries, which contains things you might never need.
2006-08-11 21:06:03
·
answer #3
·
answered by Lie Ryan 6
·
1⤊
0⤋
we speak here about c/c++ and java
c/c++ allows multiple inheritance when talking about classes. this confuses a lot sometimes... java does not allow multiple inheritance.
with c/c++ you can use variables as refferences. you have your own direct memory management. in large projects it`s a pain behind. you can directly allocate/free memory. you can also use objects. in java you can ONLY use objects.
c/c++ allows the creation and use of templates. it takes long for me to explain what templates in c/c++ are. you figure it out.
if a c/c++ programm is compiled on a windows station, it cannot run on linux / mac / freebst / etc. java programs are 100% portable. you only need jre [java runtime environment] installed. it will run.
ps for brainiac: please read javascript and java. please tell me that you can make the diffrence.
2006-08-11 20:42:16
·
answer #4
·
answered by Do RiN Entertainment, INC. 2
·
1⤊
0⤋
C is a programming language, it is very powerful
the program must be compiled differently depending on which CPU it will be run on PC or MAC
java is an internet language that will run on every different computer that can use a browser
it is more a plug in for a web browser
2006-08-11 20:41:17
·
answer #5
·
answered by brainiac 4
·
0⤊
0⤋
Java more versatile, C/C++ faster
2006-08-11 21:32:14
·
answer #6
·
answered by Nestor 4
·
0⤊
0⤋