C++ Features That Are Not Supported in Java

 

No preprocessor – You cannot use #include, #define, #if, etc.

No header files

No global variables – Every variable must be a class variable or a local variable in some function.

No global functions – Every function must be a member of some class.

No struct, no union, no typedef, no enum

No unsigned variables – All integer types are signed, so the signed and unsigned keywords are no longer valid.

No sizeof

No goto statement

No default function arguments

No delete – Memory deallocation is handled automatically for the programmer.

No operator overloading – After much debate this feature was left out of Java, since it can lead to code that is very difficult to read.

No pointers – Java uses references instead of pointers. References contain addresses, so they can be used to create dynamic data structures, but they cannot be freely manipulated like pointers are. There is no pointer arithmetic, no pointer operators * (dereference), -> (dereference a field), & (address of), and no function arguments (which require a pointer to a function).

No multiple inheritance – Java supports interfaces instead, which eliminate the complexities associated with multiple inheritance.

No templates – The built in Java class hierarchy can be used to achieve the same effect as templates.

No friend functions or friend classes – Java has a new feature called packages that serves the purpose of friends.

No type conversion functions


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page