Core Java Archive
Static inner classes: We access static members using class name. Defining a class with static keyword is called Static inner class. We access static inner class using outer class name. Creating object of static inner …
Non static inner class: Defining inner class without static keyword. Non static members we access using instance. We can access inner class using outer class instance. We need to instantiate outer class by which we …
One class cannot access the private members of another class even in Parent-Child relation. Outer class can access the private functionality of inner class. Inner class access private members of outer class as well. Non-static …
Local inner classes: Defining a class inside the block or method or constructor. It is working like a local variable in Java application. Access modifiers cannot be applied to the local inner classes. Local inner …
Anonymous inner class: Defining the class with no name is called Anonymous inner class. It is also one type of Local inner class. We define anonymous inner class inside method. Constructors are not allowed to …
What is array? Using primitive variable, we can store only one value at a time. For example int a = 10; a=20; print(a); To store more than one element of same type, we use arrays. …
Array Declaration: In the declaration of array, a memory block will be created only for array variable. With the declaration, array is not pointing to any array element. Initializing one dimensional array: int integers; // …
length: It is non static variable belongs to array object. We call ‘length’ variable on array object. It returns the length of array in int format. Read the size of array:
Access Array elements Array is automatically initializes with default values. Default values depend on type of array. We can process array elements using their index If the array is of type String, the default value …
User defined class represents object. Hence class type variable is also called pointer variable. The default value is null. We can declare array variables as static. Static variables automatically initializes with default values. The default …