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…

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…

StringBuilder in Java

We will find an answer for the following questions What is StringBuilder Available Constructors Commonly used methods StringBuilder Java StringBuilder class is used to create a mutable (modifiable) string. The Java StringBuilder class is the same as the StringBuffer class except that it is non-synchronized. So its not thread-safe and can’t be Read more…

HttpSession

When a client visits the webapp for the first time, and HttpSession is obtained for the first time the servlet container creates a new HttpSession object, generates a long and unique ID (which you can get by session.getId()), and store it in the server’s memory. The servlet container also sets Read more…

ServletContext and load-on-startup

What happens behind the scene when Web Application is deployed in Web Server like Tomcat? ServletContext It provides a set of methods that a servlet uses to communicate with its servlet container. There is one context per “web application” per Java Virtual Machine. A “web application” is a collection of servlets Read more…