string in Java

The String is used to store a sequence of characters. 
```
String greeting = "Hello World";
```
The default value of String is null. Local string requires assignment before referencing it. 
Once a String object is created, it is not allowed to change. It cannot be made larger or smaller, and you cannot change one of the characters inside it. 
The string pool, also known as the intern pool, is a location in the JVM that collects all these strings. The string pool contains all literal values. 
The + operator can be used in two ways for string concatenation. 
* If both operands are numeric, + means numeric addition.
* If either operand is a String, + means concatenation.
* The expression is evaluated left to right.

Comparing String, StringBuilder, and StringBuffer
Characteristic | String | StringBuilder | StringBuffer
----- | ----- | ----- | ----- 
Immutable? | Yes | No | No
Pooled? | Yes | No | No
Thread-safe? | Yes | No | Yes
Can change size? | No | Yes | Yes

Usage of StringBuilder and StringBuffer.
```
class Main{  
    public static void main(String args[]){  
        StringBuilder sb = new StringBuilder("Hello ");  
        sb.append("Java"); 
        System.out.println(sb); 

        StringBuffer sf = new StringBuffer("Hello ");  
        sf.append("Java"); 
        System.out.println(sf); 
    }  
} 
```