Free Guides
Language Tutorials

Index

Declarations and Access Control
-
Array Declarations
char[ ] a;
char a[ ]; -
Array Constructions
a = new char[5]; -
Combined Declaration and Construction
<element type1>[ ]<array name>=new <element type2>[<array size>];3 -
Combined Declaration, Construction and explicit Initialization
<element type>[]<array name>={<array initialize list>};
char[ ] a = {'b','c','d','e'}; -
Anonymous Array Construction
new char[ ]{'b','c','d','e'} -
In the case of multidimensional arrays, you may specify the size only for the first dimension:
String[ ][ ] s = new String[3][ ]; -
Accessing an incorrect index in the array results in an ArrayIndexOutOfBoundsException.
-
A class has two components :
-
Static Context : contains static methods, static field initializers and static initializer blocks.
-
Non-Static Context : has instance methods, constructors, non-static field initializers and instance initializer blocks.
-
-
The signature of a method contains only the method name and the formal parameter list.
-
All instance methods are passed an implicit reference to the current object, which can be referenced in the body of the instance by the keyword this, which can be used in any non-static context.
-
When a subclass object is created, all the superclass constructors are invoked in order starting from the top of the hierarchy.
-
Constructors cannot return a value and hence cannot specify a return type, not even void.
-
The only action taken by the default constructor is to call the superclass constructor.
-
If any explicit constructors are defined, then implicit default constructor will not be provided. It must be explicitly implemented.
-
Static code cannot access non-static members. Also this and super are unavailable. However, the Non-Static code can refer to the static context members.
-
An interface is an implicitly public, abstract class containing implicitly static, final variables and abstract methods (if any). Interfaces with empty bodies are used as markers to tag classes as having a certain property. Such are also called ability interfaces.