What is system.in

java

Solution

Scanner class accepts input stream as a parameter and System class have a static variable `in` which is of type `InputStream`. `System.in` gives you a instance of of type `InputStream`.

Check this `doc of public static final InputStream in`

The "standard" input stream. This stream is already open and ready to supply input data.

Problem

Consider this `Scanner` input example. ``` Scanner user_input = new Scanner( System.in ); ``` Here `Scanner` is the CLASS. `user_input` is the OBJECT under Scanner class. What is (`System.in`)? Is it a parameter passed or a object under `Scanner` class?. Consider another example. ``` dog dog1 = new dog(25) ``` Here I have set dog class to accept size as a parameter. What exactly is `System.in`?

Original source