Strings in Java


g: S

String is Immutable and String Is a final class. The String class provides for strings whose value will not change.

One accessor method that you can use with both strings and string buffers is the length() method, which returns the number of characters contained in the string or the string buffer. The methods in String Class:-

toString( ) equals( ) indexOff( ) LowerCase( )

charAt( ) compareTo( ) lastIndexOff( ) UpperCase( )

getChars( ) subString( ) trim( )

getBytes( ) concat( ) valueOf( )

toCharArray( ) replace( )

ValueOf( ) : converts data from its internal formate into human readable formate.

toString() : An instance method that converts the object to a string.

charValue() :An instance method that returns the value held by the character object as a primitive char value.

isUpperCase(char) : A class method that determines whether a primitive char value is uppercase.



No comments:

Post a Comment