// StringMethodsDemo.java
// Demonstrates some methods of class String.
public class StringMethodsDemo
{
public static void main(String[] args)
{
String text = "Hello, everyone!";
System.out.println("Consider this string: " + text);
int ecount = 0;
for ( int i = 0; i < text.length(); i++ )
if ( text.charAt(i) == 'e' )
ecount++;
System.out.println("It contains " + ecount
+ " occurrences of a lowercase \'e\'.");
System.out.println("The first five characters are: "
+ text.substring(0, 5));
System.out.println("Uppercase version: "
+ text.toUpperCase());
} // method main
} // class StringMethodsDemo