Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Important Points to Remember in Java

Tags: array
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.





********************************


This post first appeared on SCJP Tutorial -1.5 Tips And Tricks, please read the originial post: here

Share the post

Important Points to Remember in Java

×

Subscribe to Scjp Tutorial -1.5 Tips And Tricks

Get updates delivered right to your inbox!

Thank you for your subscription

×