go to previous page   go to home page   go to next page hear noise highlighting

Answer:

Yes.


Other Methods of String

There are many String methods. The following list contains just a few. For the complete list, and for detailed descriptions, see the Java documentation on the web. Java Documentation

Some of these methods are described in the exercises and in future chapters. For now, just notice that some of these methods return data about the string (such as length()) and some create new strings based on the original string (such as toLowerCase()).


public char charAt( int index )
public String concat( String str ) 
public boolean endsWith( String suffix ) 

public boolean equals( Object anObject ) 
public boolean equalsIgnoreCase( String anotherString ) 

public int indexOf( int ch ) 
public int indexOf( String str ) 

public int length() 
public boolean startsWith( String prefix ) 

public String substring( int beginIndex ) 
public String substring( int beginIndex, int endIndex ) 
public String toLowerCase() 

public String toUpperCase() 
public String trim() 

There are two substring methods. The first creates a new string consisting of characters beginning at beginIndex and continuing to the end. The second creates a new string consisting of characters beginning at beginIndex and continuing to the the character just before endIndex.


QUESTION 16:

Do any of these methods change the String object that contains them?


go to previous page   go to home page   go to next page