• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

println

 
Ranch Hand
Posts: 579
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System.out returns a PrintStream object and we call println() on it.But println() is defined in java.io.* .So how can we call it without importing
java.io package?
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahem
PrintStream also has a println method.
 
agrah upadhyay
Ranch Hand
Posts: 579
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But to use that method, should not we import the package?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it has a return statemant with a fully qualified class name ?

But probably, if we have :

import java.io.PrintStream;

public class System {
PrintStream out;
...
}

Than, compiler knows where to get that PrintStream class from, and code that uses System, doesn't have to import it anymore.
 
agrah upadhyay
Ranch Hand
Posts: 579
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx you very much Krason But

Maybe it has a return statemant with a fully qualified class name ?

What does it mean?
 
Kris Krason
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PrintStream is in java.io.*

So to use it you should either hava an import java.io.* (or java.io.PrintStream), or just use java.io.PrintStream everywhere in your file.
Fully qualified name is the java.io.PrintStream.
[ October 12, 2005: Message edited by: Krzysztof Krason ]
reply
    Bookmark Topic Watch Topic
  • New Topic