Important POints :
1)Uninitialized locations of Array in java Is Initialized with Zero.
2) Length is Non Static Variable.
Syso(arr.length);
3) Length is not a Function/Method it is Non Static Variable of a Array Object.
4) Small Program
int a[] = new int[40];
int b[] = null;
System.out.println(" >> a "+a);/*Prints Address*/
System.out.println(" >>> b "+b);/*Prints Null */
5) Array Of Objects
ClassName arrayName[] = new ClassName[5];
ArrayName is An Array which can hold Five ClassName Objects.
Where Objects are Not at Iniitliized .
Syso(arrayName[0]) /* Prints Null */
arrayName[0] = new ClassName();
Syso(arrayName[0]) /* Prints Address */
6) array OF String Objects
String s1[] = new String[3];
s1[0] = "Java";
s2[1] = "Sekhar";
s3[3] = "Ravi ";
Syso(s1[0]) /* Prints Java Not Address of the Object 'java' */
7) An Array With Zero Elements are Permitted.
Example :
int j[] = new int[0];
Syso(j[0]) /* Returns Error Bcz Array Doesn't contain any Elements */
Hi, This blog is the place who want to prepare for programming interview with major product development companies. Apart from interview questions I would like to provide some concepts on the new technologies which I learn as part of my carrier. Thanks for visiting my Blog.
Showing posts with label arrays in java. Show all posts
Showing posts with label arrays in java. Show all posts
Tuesday, October 5, 2010
Subscribe to:
Posts (Atom)
AWS certification question
AWS AWS Hi! this is for questions related to AWS questions. EC2 instances EC2 storage types cold HDD : 1. Defines performance in terms...
-
Here I am going to discuss some of the differences between Text and String class in Hadoop. Text class lies in the package: import org.ap...
-
There are 2 ways we can load data into the HIVE Tables. In this tutorial we are loading data into the HIVE managed Table. This is my sa...
-
Question : What is GWT ? Answer : Google Web Tool Kit(GWT) is a open source Java Development Framework, use to develop Ajax(Asynchronous...