• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

java IO Class

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System.in is in java.lang,but we use this in Geting Input using BufferedReader

(ie)
BufferedReader br= new BufferedReader(new InputReader(System.in))

BufferedReader is in Java.IO and System.in is in JAVA.LANG

how is it possible?

help me
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not exactly sure what you are asking here, but it is possible, in fact, necessary, to reference a class in one package from another package. You use java.lang classes in your own class which, if not specifically declared to be in a package, belongs to an anonymous package distinct from java.lang.
[ July 12, 2006: Message edited by: Joe Ess ]
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the classes in Java are located in a package. If the class is not declared in particular package it is said that the class is in the default package.

The declaration of the package of class appears at the beginning of the source file. Somewhat like this: package java.io.InputStream or java.lang.String.

For instance, this code is valid:



Now, a class should be referenced using it fully qualified named, but if you want to avoid the use of such long names as java.java.util.concurrent.locks.Lock, then you can import the class so that you can use its canonical name.

Somewhat like this:



I hope this helps clarifies your doubt.
 
reply
    Bookmark Topic Watch Topic
  • New Topic