Tutorial by Examples

Object obj = new Object(); // Note the 'new' keyword Where: Object is a reference type. obj is the variable in which to store the new reference. Object() is the call to a constructor of Object. What happens: Space in memory is allocated for the object. The constructor Object() is call...
Dereferencing happens with the . operator: Object obj = new Object(); String text = obj.toString(); // 'obj' is dereferenced. Dereferencing follows the memory address stored in a reference, to the place in memory where the actual object resides. When an object has been found, the requested meth...

Page 1 of 1