// ShowcodeKL.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-15 File created. // 2006-02-15 Last modification. // As this is a program that can receive parameters from // the command line, this should be executed in a command // prompt window where the command line parameters can // be given. It may be difficult, and even impossible, to // supply the command line parameters if this program is // executed with a modern development tool such as JCreator // or Eclipse. import java.util.* ; class ShowcodeKL { public static void main( String[] command_line_parameters ) { Scanner keyboard = new Scanner( System.in ) ; if ( command_line_parameters.length == 1 ) { // The following statement takes the first character // of the first command line parameter. char given_character = command_line_parameters[ 0 ].charAt( 0 ) ; int numerical_code = given_character ; System.out.printf( "\n\n The character code of %c is %XH (%d) \n", given_character, numerical_code, numerical_code) ; } else { System.out.print("\n You must give a character from command line.\n"); } } }