Saturday, March 24, 2018

CharInput of Java Programme

/* 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);
    }
   
}








Share:

0 comments:

Post a Comment

Blogger templates