why System.out is wrapped with PrintStream but System.in not?

E

Evol

Hello all,
As you all know, System.out and System.err are PrintStream so they are
very easy to use. But System.in is still InputStream so each time I
use it I have to wrap it with another class.

I wonder whether there is any deeper reason that leads to this. Do you
know the aim of it?

Best Regards,
Evol Song
 
D

Dave Searles

Evol said:
Hello all,
As you all know, System.out and System.err are PrintStream so they are
very easy to use. But System.in is still InputStream so each time I
use it I have to wrap it with another class.

I wonder whether there is any deeper reason that leads to this. Do you
know the aim of it?

Perhaps it's because it doesn't make much sense to "print" to an input
stream.
 
R

Roedy Green

As you all know, System.out and System.err are PrintStream so they are
very easy to use. But System.in is still InputStream so each time I
use it I have to wrap it with another class.

I wonder whether there is any deeper reason that leads to this. Do you
know the aim of it?

InputReader and PrintWriter did not exist in Java 1.0. One of the
rules of Java design is old code should continue to run, so Sun could
not very well redefine the meaning of System.in and System.out.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"People think of security as a noun, something you go buy. In reality, it’s an abstract concept like happiness. Openness is unbelievably helpful to security."
~ James Gosling (born: 1955-05-18 age: 54), inventor of Java.
 
L

Lew

Evol said:
As you all know, System.out and System.err are PrintStream so they are
very easy to use. But System.in is still InputStream so each time I
use it I have to wrap it with another class.

I wonder whether there is any deeper reason that leads to this. Do you
know the aim of it?

Please do not multipost.
 
E

EJP

Evol said:
very easy to use. But System.in is still InputStream so each time I
use it I have to wrap it with another class.

No you don't. You can read bytews from it directly with three different
methods.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top