Java syntax has many similarities to C and C++.
|
Some differences
-
No malloc or free - it has automatic garbage collection.
-
No pointers - designers felt pointer arithmetic not robust or safe.
-
Can declare variables almost anywhere as needed.
-
No struct, union, enum, typedef from C- it has classes and objects instead.
-
Primitive types for integers and floats have machine independent semantics
-
IEEE standard definitions - same answer on all machines.
|
Some similarities
-
All variables must be declared
-
Syntax and comments
-
Control structures: if, while, and for statements, expressions
|