Java Programming Example of converting all characters in the string to upper case and vice versa

This program accepts the string from the keyboard and convert all the characters in the strings into upper cases and vice versa.

import java.io.*;

/**
 *
 * @author JavaHotSpot
 */

public class stringULCase
{
  public static void main(String args[])
 {

     String s1,s2,upper,lower;
     DataInputStream d;
     try
     {
     System.out.println("Enter the String in Lowercase");
     d=new DataInputStream(System.in);
     s1=(String)d.readLine();
     upper=s1.toUpperCase();
     System.out.println("Lowercase="+s1+" Uppercase ="+upper);
     System.out.println("Enter the String in Uppercase");
     s2=(String)d.readLine();
     lower=s2.toLowerCase();
     System.out.println("Uppercase="+s2+" Lowercase ="+lower);
     }
     catch(Exception e)
     {
         System.out.println(e.toString());
     }
 }
}

Output:
Enter the String in Lowercase
javaatweet
Lowercase=javahotspot Uppercase =JAVAHOTSPOT
Enter the String in Uppercase
JAVAHOTSPOT