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 Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
DataInputStream is used to read files/streams written by the DataOutputStream class.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
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 Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656