DataInputStream deprecated readLine() method

InputStream is fundamentally a binary construct. If you want to read text data (e.g. from the console) you should use a Reader of some description. To convert an InputStream into a Reader, use InputStreamReader. Then create a BufferedReader around the Reader, and you can read a line using BufferedReader.readLine().

More alternatives:

  • Use a Scanner built round System.in, and call Scanner.nextLine
  • Use a Console (obtained from System.console()) and call Console.readLine

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)