Static keyword in Java

The static keyword can be used with class, variable, method and block. Static members belong to the class instead of a specific instance, this means if you make a member static, you can access it without an object. Static Block A static block is used for initializing the static variables. Read more…

Memory Leak in Java

Memory Leak The standard definition of a memory leak is a scenario that occurs when objects are no longer being used by the application, but the Garbage Collector is unable to remove them from working memory – because they’re still being referenced. As a result, the application consumes more and Read more…

Java Garbage Collection

Java Garbage Collection is the process to identify and remove the unused objects from the memory and free space to be allocated to objects created in the future processing. One of the best feature of java programming language is the automatic garbage collection, Garbage Collector is the program running in Read more…

Java is Pass by Value

One of the biggest confusion in Java programming language is whether java is Pass by Value or Pass by Reference. First of all, we should understand what is meant by pass by value or pass by reference. Pass by Value: The method parameter values are copied to another variable and Read more…

Reverse a String is Java

There are many ways to reverse a String in Java. We will see traditional ways and using classes that provide an in-build function. 1. Storing in reverse Order In the above piece of code. We have assigned a char of length of String passed to it. In the loop we are Read more…

Difference between StringBuffer and StringBuilder

Based on my previous posts related to StringBuffer and StringBuilder let’s see the difference. StringBuffer StringBuilder StringBuffer was the only choice for String manipulation till Java 1.4 StringBuilder came into picture from Java 1.5. all of its public methods are synchronized all of its public methods are not synchronized StringBuffer provides Thread safety. StringBuilder Read more…

StringBuffer in Java

We will find an answer for the following questions What is StringBuffer Available Constructors Commonly used methods StringBuffer Java StringBuffer class is used to create a mutable (modifiable) string. The StringBuffer class in java is the same as the String class except it is mutable i.e. it can be changed. The Read more…