Results 1 to 2 of 2

Thread: Simple input/output question

  1. #1

    Thread Starter
    Member
    Join Date
    May 2002
    Location
    AUS
    Posts
    38

    Simple input/output question

    I want to ask a question and then returmn the response as a string but I am not sure how to get inputback from th user and store it as a variable.

    Something like:

    System.out.print("Ask the user a question?");
    String response = getresponse();


    How can I code the above statement?

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Code:
    import java.io.*;
     
    BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    
    String s = buff.readLine();

Posting Permissions

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



Click Here to Expand Forum to Full Width