KnowledgeBoat Logo
LoginJOIN NOW

Computer Applications

What are String and StringBuffer classes of Java?

Java String Handling

8 Likes

Answer

In Java, we can work with characters by using String and StringBuffer class.

String class — The instances of String class can hold unchanging string, which once initialized cannot be modified. For example,

String s1 = new String("Hello");

StringBuffer class — The instances of StringBuffer class can hold mutable strings, that can be changed or modified. For example,

StringBuffer sb1 = new StringBuffer("Hello");

Answered By

6 Likes


Related Questions