C++ Equivalents

Functions

  • Static methods

Multiple inheritance

  • Roughly approximated by interfaces

Constants, preprocessor variables

public final static FILE_NEW = 1;

Structures

  • Objects

Typedefs

  • Classes
  • Interfaces

Inline Functions

  • If use final keyword for a method, the compiler may expand the call if the method is below a certain size (other factors may influence it as well).

Call by reference (for simple data types)

  • Wrappers
  • Arrays
  • Objects are always (in effect) passed by reference, only simple data types are not.
Examples
// Using an array to pass an int by reference
int[] myArray = new int[1];
myArray[0] = 50;
System.out.println(myArray[0]);

Freeing memory

myObject.finalize(); // Perform any user-defined cleanup work for the object (the garbage
// collector automatically calls this method anyways, before freeing
// the memory for the object).
System.gc(); // Forces garbage collection
System.runFinalization(); // Calls the finalize() method for all objects awaiting garbage collection.
// Doesn't necessarily perform garbage collection though.

Resources URL: 
notes/java/resources
Sources URL: 
notes/java/sources

See Also