English

Explain the utility of java.lang.String class.

Advertisements

Question

Explain the utility of java.lang.String class.

Explain
Advertisements

Solution

  1. String Creation: The String class is used to create and store a sequence of characters as a single object.
  2. String Concatenation: It allows two or more strings to be joined together using the concat() method or the + operator.
  3. String Comparison: It provides methods such as equals() and compareTo() to compare the contents of strings.
  4. String Length: It provides the length() method to determine the number of characters present in a string.
  5. Character Extraction: It provides the charAt() method to access a character at a specified position in a string.
  6. String Manipulation: It provides methods such as toUpperCase(), toLowerCase() and substring() to perform various operations on strings.
shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Primitive Values, Wrapper Classes, Types and Casting - EXERCISE [Page 112]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 5 Primitive Values, Wrapper Classes, Types and Casting
EXERCISE | Q 7. | Page 112
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×