The System.in object

The System class in the Java.lang package has a static member variable in that represent keyboard. In is a statement of inputstream class. Thus system.in object gives the inputstream reference.

public class Example6
{
public static void main(String args[])
{
char ch;
StringBuffer s=new StringBuffer();
Try
{ while(((ch=(char)System.in.read())!='\n')
{
s.append(ch);
}
}
catch(Exception e)
{
{
System.out.println(s);
}
}

It's very calm over here, why not leave a comment?

Leave a Reply