Posts

Showing posts with the label Strings in java

String Class in Java

Image
String class in Java This blog is related to the String class present in java. The following points are covered  below:- What is String? How to declare a String? Why String is immutable? What is a String Constant Pool? How to check that String objects have equal values? How to compare two String references? What is String?  Java provides a Stri ng class to manipulate the sequence of characters. The sequence of characters value is considered a String. Once a String object is created, we are not able to change its state. In other words, we can say that It is immutable.  String test="test"; //is equivalent to char c[]={'t','e','s','t'}; String class public final class String extends Object implements Serializable, Comparable<String>, CharSequence How to declare a String? //By using a new keyword String s1=new String(); //String literal String s2="Test"; ...