Results 1 to 2 of 2
  1. #1
    bhauteshved is offline Member
    Join Date
    Sep 2011
    Posts
    3
    Rep Power
    0

    Default System.in.read()

    I have written a Calculator program(attached below).
    I have a line choice = (char)System.in.read(); in a while loop.

    The line executes during the first iteration of the loop but is simply skipped during the second iteration onwards.

    Any suggestions to solve this problem.

    Thanks.

    Bhautesh
    Attached Files Attached Files

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: System.in.read()

    Quote Originally Posted by bhauteshved View Post
    Any suggestions
    Yes. Dont use System.in.read to gather user input. Use a BufferedReader or Scanner instead.

Similar Threads

  1. System.in.read()
    By Adithi in forum New To Java
    Replies: 3
    Last Post: 08-07-2011, 05:19 PM
  2. system.out.printf versus system.out.format
    By bigsonny in forum New To Java
    Replies: 10
    Last Post: 06-21-2011, 10:40 PM
  3. How to read xml file located in local system using Java
    By java_kick in forum Advanced Java
    Replies: 2
    Last Post: 04-06-2009, 11:28 PM
  4. System.in.read() confusion
    By ankurdh in forum New To Java
    Replies: 5
    Last Post: 01-08-2009, 08:28 AM
  5. System.in.read(); strange error!
    By kantze in forum New To Java
    Replies: 2
    Last Post: 03-19-2008, 01:44 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
  •