Java1: Section 2.5, The String Class

The methods of the String class can be found on pg 81.

Fill in all the gaps, then press "Check" to check your answers. Use the "Hint" button to get a free letter if an answer is giving you trouble. You can also click on the "[?]" button to get a clue.

// This example gives practice on using the methods of the String class (p 82)
// Complete the code as prompted by the comments.

public class
public (String [] args)
//Instantiates and prints a string variable
String word = new String ("abcdefg");
System.out.println("Given this String: " + word + ".");

//Prints the length of the string using the length() method.
System.out.println("The length is " + + ".");

//Prints the chararacter 'c' and names its index location.
System.out.println("The character " + word.charAt() + " is at index " + word.indexOf("c") );

//Prints the substring "cde"
System.out.println("A substring of the middle 3 characters is " + word.substring(,)+");

//Prints the concatenation of the uppercase version and the lower case version of the string.
System.out.println( word..concat();