String class Javadoc
Go to the class website and click the Java
Documentation link. Click on API & Language at the top, and
then on Java 2 Platform API
Specification. This will bring up the Javadoc for everything
that is
included in Java. To get to the Javadoc page for the String
class,
either find String in
the list of classes on the left side, or find the
java.lang
package on the right side. There will be a link to
String in there.
Look at the documentation for the following methods:
charAt(int index)
compareTo(String anotherString)
compareToIgnoreCase(String str)
equals(Object anObject)
equalsIgnoreCase(String anotherString)
indexOf(String str)
indexOf(String str,
int fromIndex)
lastIndexOf(String str)
lastIndexOf(String str,
int fromIndex)
length()
substring(int beginIndex)
substring(int beginIndex,
int endIndex)
toLowerCase()
toUpperCase()
1. What is the index (a number) of the first
character in a String?
2. How do you get the length of a String?
3. How can you determine the index of the last
character in a String?
4. List 2 ways to get the first letter of a String.
(One will result in a char, the other a String)
5. How can you get all of the letters of a String
except for the first letter?
6. How can you find the index of the first space (" ")
character in a String?
7. How can you find the index of the second space (" ")
character in a String?
8. When you try to find the index of a character in a
String, how can you determine that it was not found?
9. How can you convert a character to a String?
10. Is the method Character.toLowerCase(char)
mentioned in the documentation for the equalsIgnoreCase() method a
class or instance method?