Strings are generally sequence of characters.
Java treats String as an Object.
Java has a class named String which has numerous methods using which one can perform various operation on String object. The String class is in java.lang package.
String class implements
· Serializable interface
· Comparable interface
· CharSequence interface.
Create String Object
In java, String object can be created in the following two ways:
1. String literal
String s = “Java”;
2. By using new keyword
String s = new String(“Java”);
Most important characteristics of java String is immutability. String is immutable in java.
No comments:
Post a Comment