viewing paste TestUppercaseToLowercase | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import java.util.Scanner;
 
public  class   TestUppercaseToLowercase{
 
        public  static  void    main(String[] args){
                Scanner scan = new Scanner(System.in);
                System.out.print("Please input any uppercase letter: ");
                char letter = scan.next().charAt(0);
                char character = upperCaseToLowerCase(letter);
                System.out.print("You typed in: "+letter+". The lowercase equivalent is: "+character);
               
        }
        public  static  char    upperCaseToLowerCase(char character){
                int offset = (int)'A' - (int)'a';
                character = (char)((int)character - offset);
                return character;
        }
}
Viewed 525 times, submitted by Streusel.