Explain the utility of java.lang.String class.
Advertisements
प्रश्न
Explain the utility of java.lang.String class.
स्पष्ट कीजिए
Advertisements
उत्तर
- String Creation: The String class is used to create and store a sequence of characters as a single object.
- String Concatenation: It allows two or more strings to be joined together using the
concat()method or the+operator. - String Comparison: It provides methods such as
equals()andcompareTo()to compare the contents of strings. - String Length: It provides the
length()method to determine the number of characters present in a string. - Character Extraction: It provides the
charAt()method to access a character at a specified position in a string. - String Manipulation: It provides methods such as
toUpperCase(),toLowerCase()andsubstring()to perform various operations on strings.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
