-2

What is system.in.read() here, where can i find every detail and use of it and where it is in documentation? in classes or whaterver ?

char ch;
ch=(char)System.in.read();
System.out.println("you typed"+ch);
Aj Jadoon
  • 31
  • 5
  • 9
    http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#in ? –  Feb 27 '14 at 17:28

3 Answers3

1

System.in returns an InputStream. The method read() without parameters "Reads the next byte of data from the input stream." according to the documentation.

Brian
  • 2,999
  • 4
  • 25
  • 47
0

System.in is basic reading in:

Scanner suckItUp=new Scanner(System.in);
System.out.println("Enter your favorite soda: ");
String name=suckItUp.nextLine(); 

System.in is the InputStream. It is usually connected the keyboard, but may also be connected to console.

first, always head to the API

Here's a nice link - Java IO tutorial

How to read a single char from the console in Java (as the user types it)?

How can I read input from the console using the Scanner class in Java?

Read up on this valuable topic. Java IO is super-important.

Community
  • 1
  • 1
Caffeinated
  • 10,270
  • 37
  • 107
  • 197
0

read() is an instance method of the static variable named 'in' of the System class

robermann
  • 1,682
  • 10
  • 19