This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to create? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to create?" Watch "how to create?" New topic
Author

how to create?

Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 483
I know in java.lang (Base)package we have Class System & its object out. println() is the method. So we can write
java.lang.System.out.println("something");
or
System.out.println("something");

But i want to create
java.xxx.Printer.out.write("Something");

means i should create package which include Class Printer which is similer to Class System & its object out. write should be method.

for prearing this i am reading java doc 6.0 base class java.lang & related doc. & reading System.java in NetBeans5.5.1.
So any body just give me clue/hint.


Millions saw the apple fall, but Newton asked why.
If you understand, say "understand". If you don't understand, say "don't understand". But if you understand and say "don't understand". How do I understand that you understand? Understand!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

What part do you need a hint with? "out" is a static variable in class System; it's an instance of PrintStream. There isn't anything more to it than that.


[Jess in Action][AskingGoodQuestions]
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 483
i want to create whenever i want to print any statement in my program i should write Printer.out.write("Something") instead System.out.println("Something")
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
This has a lot of information in it:

Printer, starting with a capital letter, is most likely a class name. So when you reference its field out, out must be a public static field. And the field out refers to some object that has a write(String) method.

What do you have to write to make all of that true? Take a shot at a beginning, even if it's only a line or two. Then we'll know exactly where you're stuck.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 483
I try this for string output in my program using Printer.out.write instead of System.out.println.

Now i will try for as in java program we import java.lang.*(i know its automatically imported) same way i want to import package so without writing this code again & again, i can directly use Printer.out.write. means if anybody want to see my java file he/she cannot find System.out.println statement.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to create?
 
Similar Threads
for System.out.println() why we don't we import java.io.* package
Object Class
important package
Object "Savvy"
Threads