Sunday, July 12, 2009

Important Points to Remember in Java

Method Parameters:
Types of Method Parameters in Java:

a) Formal Parameters-->They are the parameters defined in the method definition.

b) Actual Parameters--> They are the parameters defined in the method call.

c) Final parameter--> If a formal parameter is declared to be final, then its value cannot be changed during its lifetime in the method body.

Note: Widening, narrowing, type promotion rule applies to the parameter passing as well. They are equivalent to assignment conversions.

2. Arrays: 

a) Array--> Its a collection of homogeneous data elements.

b) Array Declaration-->Syntax for array declaration is as follows:

    (datatype)[](arrayname) or (datatype) (arrayname)[]

c) Array Construction--> This means allocating space to the array in computer memory. Its syntax is:

  (arrayname)=new (datatype)[(arraysize)]

d) Value assignment--> This means assigning values to the array elements.

e) Array Initialization--> Java provides the means of declaring, constructing and explicitly initializing an array in one declaration. Its syntax is:

(datatype)[](arrayname)={(array initialization list)};


3. Anonymous Array--> They are used to initialize the array objects which are already declared. like:
   int a[];
 a=new int[]{1,5,5,3,9,7,3}; we cannot use a={1,5,5,3,9,7,3}; to initialize an array already declared.


Search Amazon for Best Books on Java J2EE


blogarama - the blog directory

Search your favourite topics