Core Java Archive

Static Method in Java

Static user method: Every program is a collection of methods. Main() method is the starting point of application. JVM invokes the main() method automatically. We can define user methods depends on application requirement. Static methods …

Java codes on static

Write the output: Output it: Any object(class) type variable holds address of object. Pointer variables can hold address. Pointer default value is null, hence any class type variable default value is null.

Non static members in Java

Non Static Members: The common functionality of application must be defined as static. Non static represents the specific functionality of Object in application. We can define 4 non static members in a class. Constructor Non …

Instance block in java

Non static block: Defining a block without identity. It is also called Instance block or Anonymous block. Instance block executes automatically by the JVM. We cannot access explicitly – because no name to call. It …

this keyword in Java

this: It is a keyword. It is called pre-defined non static variable. It holds object address. this = object address; It must be used only in non static context. We can display object address using …

Non static method in java

Non static method: A method is a block that performs a task. Methods having identities, hence we can call explicitly. Non static methods must be defined without static keyword. We can access the static method …

Object Reference variable in java

Object Reference Variable: “new” keyword allocate object memory at random location. Non static variable get memory inside object(if any). Constructor initialize(assign values to non static variables) object after creation. After object initialization, constructor returns the …

Non static variables in Java

Non static variables: Variable stores information. Static variables store common information of all objects. Non static variables store specific information of object. Static variables get memory only once – sharable data Non static variables get …

Object initialization in java

Object initialization: Object stores non static variables. Non static variables automatically initializes with default values. We access these variables using address. Non static variables get memory inside every object and initializes with default values automatically. …

Create Object in Java static block

Local variable belongs to the same block in which it has defined. We cannot access local variable of one block from another block. Creating object in static block: After object creation in static block if …

Courses Enquiry Form