Java string inbuilt functions
,• string is basically an object that represents sequence of
char values.
• java.lang.String class implements Serializable,
Comparable and CharSequence interfaces
CharSequence Interface
• CharSequence interface is used to represent sequence of
characters
• It is implemented by String, StringBuffer and StringBuilder
classes
,• java String is immutable i.e. it cannot be changed
• mutable string, you can use StringBuffer and
StringBuilder classes
String in java
• java.lang.String class is used to create string object.
• There are two ways to create String object:
By string literal
By new keyword
, String Literal
• String literal is created by using double quote
String s="welcome";
• Java more memory efficient
• JVM checks the string constant pool
• String objects are stored in a special memory area
known as string constant pool.
,• string is basically an object that represents sequence of
char values.
• java.lang.String class implements Serializable,
Comparable and CharSequence interfaces
CharSequence Interface
• CharSequence interface is used to represent sequence of
characters
• It is implemented by String, StringBuffer and StringBuilder
classes
,• java String is immutable i.e. it cannot be changed
• mutable string, you can use StringBuffer and
StringBuilder classes
String in java
• java.lang.String class is used to create string object.
• There are two ways to create String object:
By string literal
By new keyword
, String Literal
• String literal is created by using double quote
String s="welcome";
• Java more memory efficient
• JVM checks the string constant pool
• String objects are stored in a special memory area
known as string constant pool.