• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

What exactly is System.in ?

 
Ranch Hand
Posts: 56
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look at this:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

Im so confused! What on earth is system.in? Is it an object of some sort?
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

System is a class. And "in" is a static variable of that class. And what that static variable is, is an InputStream for standard input.

Henry
 
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ahmad Auada wrote:Im so confused! What on earth is system.in? Is it an object of some sort?



Welcome, Ahmad. Henry's answer is correct. Let me add that, in Java, case matters. So, "System.in" refers to a static variable that is a member of the "System" class. There is no "system" class in the Java libraries (and it is universal practice to use a capital letter as the first letter of a class name). So, when you use it, remember to capitalize the "S" in "System." Your code won't compile if you don't (unless you have a variable of your own, named "system," which would probably just be confusing in most cases).
 
Ranch Hand
Posts: 373
3
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and i add little more:

System class holds methods and fields which are specifically related to the computer you are using and the runtime you are running
 
Ahmad Auada
Ranch Hand
Posts: 56
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh I get it now!
Thanks guys! ยด=)
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic