Results 1 to 2 of 2
  1. #1
    hqt is offline Member
    Join Date
    Nov 2011
    Rep Power

    Question Using BufferedReader

    I have this code, purpose is print again what user have typed.
    Java Code:
     BufferedReader kb = new BufferedReader(new InputStreamReader(;
    System.out.println(kb.readLine()); //successful;
    } //compiled, but not successful:It doesn't print what I have typed;
    So, who know what wrong it is, help me please.
    thanks :)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Using BufferedReader

    The BufferedReader#readLine() method returns what is read in as a String. In your second attempt to use it you're reading in from the BufferedReader but not saving the String that is returned but instead just discarding it, and then trying to print out the BufferedReader object itself which you're finding doesn't work. It's as if you wrote a letter to someone and then threw out the letter but mailed them the pen you used. Instead you want to create a String variable, assign to it the String that is returned by the readLine() method and then print it out.

Similar Threads

  1. How to use BufferedReader?
    By ProgramBeginner in forum New To Java
    Replies: 4
    Last Post: 10-11-2011, 03:56 PM
  2. use of BufferedReader?please help
    By Cosmos in forum New To Java
    Replies: 11
    Last Post: 07-17-2011, 05:55 PM
  3. BufferedReader
    By Nerijus in forum New To Java
    Replies: 4
    Last Post: 04-26-2010, 08:28 PM
  4. BufferedReader, need help!
    By zacharyrod in forum New To Java
    Replies: 10
    Last Post: 11-19-2009, 11:56 AM
  5. BufferedReader
    By in forum New To Java
    Replies: 2
    Last Post: 09-18-2008, 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts