// Codefinder.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-12 File created. // 2006-02-12 Last modification. import java.util.* ; class Codefinder { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; System.out.print( "\n This program can find character codes" + "\n of different characters. The program" + "\n stops when you enter the percent sign %.\n\n "); char character_from_keyboard = '?' ; while ( character_from_keyboard != '%' ) { System.out.print( " Give a character " ) ; character_from_keyboard = keyboard.nextLine().charAt( 0 ) ; int character_code = character_from_keyboard ; System.out.printf( " Code of %c is %4d (%X hexadecimal)", character_from_keyboard, character_code, character_code ) ; } } }