import java.awt.Graphics; public class TestString extends java.applet.Applet { public void paint(Graphics g) { String str = "Free the bound periodicals"; g.drawString("The string is: " + str, 5, 50); g.drawString("Length of this string: " + str.length(), 5, 70); g.drawString("The character at position 5: " + str.charAt(5), 5, 90); g.drawString("The substring from 17 to 22: " + str.substring(17, 22), 5, 110); g.drawString("The index of the character d: " + str.indexOf('d'), 5, 130); g.drawString("The index of the beginning of the " + "substring \"bound\": " + str.indexOf("bound"), 5, 150); g.drawString("The string in upper case: " + str.toUpperCase(), 5, 170); } }