You need to do some more research on the classes you are using.
For example what does the API doc for the DataInputStream class say it is used for?
The data that is read is translated into an internal format, not into Strings.
What happened when you used the BufferedInputStream?
How about trying the BufferedReader class or the Scanner class?
Do a Search on this forum for lots of code samples.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
DataInputStream is used to read files/streams written by the DataOutputStream class.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
it can't be used for read user inputs
Mostly No. It is difficult to enter the correct format for the data from the keyboard.
There are other better ways as mentioned above.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Question Answered as of 1 Year Ago by
NormR1,
masterofpuppets
and
jackmaverick1