C++ vs. Java: Similiarities & Differences: Dr. Jeyakesavan Veerasamy
C++ vs. Java: Similiarities & Differences: Dr. Jeyakesavan Veerasamy
Java:
Similiarities & Differences
Dr. Jeyakesavan Veerasamy
Director of CS UTDesign program &
CS Teaching Faculty
[email protected]
University of Texas at Dallas, USA
History
C (1969) C++ (1979) Java
(1995)
Both support OOP. Most OOP library
contents are similar, however Java
continues to grow.
Syntax is very close Java has strong
influence of C/C++. Easy to learn the
other language when you know one
of these.
file2.cpp
Compil
er
Compil
er
file1.o
file2.o
filen.cpp
Compil
er
filen.o
Linker
This
appliction
runs directly
on top of OS.
application
(executable)
C++ compiler
does not care
about filenames.
file2.java
Compil
er
Compil
er
Compil
er
file1.class
file2.class
filen.class
filen.java
Java
Java
Java
Automatic Garbage
Collection.
Specifically operator
overloading was thrown
out.
Code
Stack
Objects
Objects in Heap
C++:
ComplexType *num1 = new
ComplexType();
Java:
ComplexType num1 = new
ComplexType();
Arrays
References
C++ tutorials:
http://www.cplusplus.com/files/tutorial.pd
f, http://www.learncpp.com/
C++ reference:
http://en.cppreference.com/w/
Java tutorial:
http://docs.oracle.com/javase/tutorial/
Java API documentation:
http://docs.oracle.com/javase/6/docs/api/