Several things happen in a particular order to ensure the object is constructed properly: Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its super classes. Implementation-specific data includes pointers to class and method data. The instance variables of the objects are initialized to...

Read More

The JVM divided the memory into following sections.     Heap,Stack,Code,Static     The code section contains your byte-code.     The Stack section of memory contains methods, local variables and reference variables.     The Heap section contains Objects (may also contain reference variables).     The Static section contains Static data/methods.Now ...

Read More

JDK :  JDK is a software bundle consists of binary files such as (javac, java, javadoc, jdb, javap, rmic....), java library files (both old and new) and some header files. Development environment requires this software. JRE:  JRE is also a software bundle same as JDK excluded with some binary files (especially compiler - javac and rmic). Required t...

Read More

The Sun/Oracle HotSpot Java Virtual Machine is available for use in two flavors – the Client VM and the Server VM. The VM to be used can be specified by the -server and -client switches passed when starting the JVM with the java command. The default VM when no switch is specified is the Client VM. The difference, in a nutshell, is that the Client V...

Read More

The Java Class Loader is the class responsible for finding and loading class files at run time. Creating your own ClassLoader lets you customize the JVM in useful and interesting ways, allowing you to completely redefine how class files are brought into the system. The following part is taken from JavaDoc Class ClassLoader java.lang.Object jav...

Read More

The static class loading is done through the new operator. class MyClass { public static void main(String args[]) { Car c = new Car(); } }Dynamic class loading is a technique for programmatically invoking the functions of a class loader at run time. Let us look at how to load classes dynamically.  //static method which retu...

Read More

Garbage collector frees the memory occupied by the unreachable objects during the java program by deleting these unreachable objects. It ensures that the available memory will be used efficiently, but does not guarantee that there will be sufficient memory for the program to run. The GC ( Garbage collector) runs on a dameon thread. A dameon thread ...

Read More

The JVM controls the Garbage Collector; it decides when to run the Garbage Collector. JVM runs the Garbage Collector when it realizes that the memory is running low.  One can request the Garbage Collection to happen from within the java program but there is no guarantee that this request will be taken care of by JVM. The Garbage Collection process ...

Read More

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

Read More

Heap memory The heap memory is the runtime data area from which the Java VM allocates memory for all class instances and arrays. The heap may be of a fixed or variable size. The garbage collector is an automatic memory management system that reclaims heap memory for objects. Eden Space: When an object is newly constructed it’s created in the Young ...

Read More

There are 3 types of garbage collection: Minor GC Major GC Full GC Minor GC: It’s also called as Scavenge GC. This is the GC which collects garbage from the Young Generation. Major GC: This GC collects garbage from the Old Generation Full GC: This GC collects garbage from all regions i.e. Young, Old, Perm, Metaspace. When Major or Full GC run all a...

Read More

There are 4 GC algorithms available in the Java Hotspot VM: The Serial GC – The serial collector uses a single thread to perform all garbage collection work. It is best-suited to single processor machines, because it cannot take advantage of multiprocessor hardware. It’s enabled with the option -XX:+UseSerialGC. The Parallel GC – The parallel colle...

Read More

Java class loaders are used to load classes at runtime. Class Loader in Java works on three principle: Delegation: Delegation principle forward request of class loading to parent class loader and only loads the class, if parent is not able to find or load class. Visibility : Visibility principle allows child class loader to see all the classes load...

Read More

An Object becomes eligible for Garbage collection or GC if it’s not reachable from any live threads or any static references in other words you can say that an object becomes eligible for garbage collection if it’s all references are null. Cyclic dependencies are not counted as reference so if Object X has reference of object Y and object Y has ref...

Read More

In the language like C,a programmer needs to manually do the memory management by allocating and de-allocating memory programmatically, but Java provides automatic memory management system,where a programmer does not worried about allocating/de-allocating memory at all ,but an utility which is an integral part of JVM does it for programmer automati...

Read More

From the uninitiated or the still in the learning phase of Java, the answer would definitely be that Java is "pass by reference". Rather than giving the answer we'll try to arrive at it. To start with let's assume Java is pass by reference like the much talked about predecessor C++. Let us try out the following code. It tries to update an ArrayList...

Read More

FOLLOW US ON LinkedIn



Explore Tutu'rself