Core Java Archive

Static Inner classes in java

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 classes in Java

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 …

Access Private members of Inner classes

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 in java

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 classes in Java

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 …

Arrays in Java

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. …

Java Array initialization

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; // …

Java Array – length

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:

Java – Access array elements

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 …

Java – Static array variable

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 …

Courses Enquiry Form