/* Reading a character from Keyboard */
package CharInput;
import java.io.DataInputStream;
public class CharInput
{
public static void main(String[] args)
{
DataInputStream in = new DataInputStream(System.in);
char ch;
try
{
pr("Enter a Character : ");
ch = (char)System.in.read();
prln("You have enterred : "+ch);
}
catch(Exception e){
}
}
static void prln(Object anyObject)
{
System.out.println(anyObject);
}
static void pr(Object anyObject)
{
System.out.print(anyObject);
}
}
0 comments:
Post a Comment