I am taking my first class in Java and am having problems with converting lowercase letters to uppercase and am not having success. The program compiles and executes. However, the lowercase letters input by the user are not converted to uppercase.
I think the problem is very simple, but I can't see it. Does anyone have a suggestion?
Dehatim
/**
This program reads a string of lowercase letters typed on the
keyboard, converts them to uppercase letters, and displays
them.
*/
// Import necessary classes.
import java.util.Scanner;
// Start main part of program.
public class CaseConversion
{
public static void main(String[] args)
{
// Create a scanner keyboard to accept input from the keyboard.
Scanner keyboard1 = new Scanner(System.in);
// Ask user to type lowercase alphabet.
System.out.println("Welcome to Letter Conversion!\n");
System.out.println("Enter the letters of the alphabet in
lowercase");
// Read in user entry.
String word1 = keyboard1.next( );
[B]// Find out what's in the string.
word1.substring(0, 26);
// Convert input into uppercase letters.
String word2 = word1.substring(0, 26);
word2.toUpperCase();
// Output the result.
System.out.println("The alphabet is now is [/B]
[B] uppercase:\n" + [/B][B]word2);
[/B]
} // end of main()
} // end of class CaseConversion