Core Java - Strings
What is String ?
• String is a pre-defined class available in [Link] package
• String we can use as a data type also (Referenced Data Type)
Note : Every class in the java can be used as a referenced data type
• String is used to store group of charaters {Char Sequence}
• String is Immutable - String objects cant be modified
2
Why String Immutable?
String objects cannot be
modified
String Interface
Implementation
String Literal Architecture
String New Architecture
String Methods
• charAt() ---> Returns the character value of the particular index
• length() ---> Returns the total length of the char sequence
• equals() ---> Checks the equality of the String with given object
• equalsIgnoreCase() ---> Checks the equality of the String with given object and ignores
the case sensitivity
• isEmpty() ---> Checks the given String is empty or not
• substring() ---> To take a particular portion of a String
• substring() ---> To take a particular portion of a String from begin index to end index
• concat() ---> To appends the String to the given string
7
String Methods
• replace() ---> To replace the existing char with the given char (Group of Chars also
can be replaced)
• indexof() ---> Returns the index value for the char in the string
• trim() ---> Removes the space from start and end of the string
• [Link]() ---> Coverts the int to string
• toLowerCase() ---> Converts from upper to lower case
• toUpperCase() ---> Coverts from lower to upper case
• [Link]() ---> Returns a joined string with delimiter
• split() ---> Splits the given string with delimiter or group of chars
8
thank you
JAYACHANDRAN
9444624939