Re: datainput stream

From: Amey Samant (ameyas7_at_yahoo.com)
Date: 12/10/03


Date: 10 Dec 2003 05:41:24 -0800


"Anthony Borla" <ajborla@bigpond.com> wrote in message news:<90rBb.46324$aT.24@news-server.bigpond.net.au>...
> "Amey Samant" <ameyas7@yahoo.com> wrote in message
> news:669e50b8.0312091016.1d726b19@posting.google.com...

> No, I don't have the time to conduct such experiments. I believe I've been
> more than helpful:
>
> * Posted useful code which you can modify and use
> * Briefly described why you were experiencing such
> difficulties
>
> I suggest that you re-read the tutorials noting the reasons why both stream
> and reader [character stream] classes exist.
> Anthony Borla

hi
first of all thanx for taking your precious time out to help me
i dont know what level you cosider yourself at with java but i request
you think this from a "novice" point of view

THIS IS WITH REFERENCE TO DOCUMENTATION FOR j2se

1. System.in is an InputStream
2. DataInputStream has a constructor that takes InputStream
   so new DataInputStream(System.in) is absolutely right
3. now DataInputStream has a method with following signature
   public final int readInt()throws IOException
4. thus if i write
   int a=(new DataInputStream(System.in)).readInt();
   it should store an integer in variable 'a' as the return type is an
'int' for readInt()
5. now when you print this 'a' using System.out.println(a);
   why should it not print correctly ??????

the method you suggested is "long cut" however well known it might be
i mean to read an integer why i have to read a Line & parse the int

there must be other easier way
also im not looking for a method to read an integer ....you can read
it thousand ways ....
i was freaked by above points
i hope i make it clear

can anyone explain not just "Anthony Borla"

amey



Relevant Pages