program:
import java.io.*;
public class Keyboard {
public static void main( String[ ] args ) {
try
{
System.out.print( "Please press any key: " );
char key = ( char )System.in.read( );
System.out.print( "The key pressed was: " + key );
}
catch( IOException ioe )
{
// do something about the exception
}
} // end of main
} // end of class definition
--------------------------------------------------------------------------------------------------------------------
import java.io.*;
public class Keyboard {
public static void main( String[ ] args ) {
try
{
System.out.print( "Please press any key: " );
char key = ( char )System.in.read( );
System.out.print( "The key pressed was: " + key );
}
catch( IOException ioe )
{
// do something about the exception
}
} // end of main
} // end of class definition
--------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment