Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: just like to know what this method does as a whole

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default just like to know what this method does as a whole

    public static String readLine(String prompt) {
    String input = "";
    System.out.print(prompt);
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
    try {

    input = br.readLine();

    } catch (IOException ioe) {
    }
    return input;
    }
    }


  2. #2
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: just like to know what this method does as a whole

    Prints a "prompt" text and then asks the user a line of text from the standard-input. It isn't really the best approach at technical level but works.
    Andrea, www.andbin.netSCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginnersMy new project Java Examples on Google Code

Similar Threads

  1. Replies: 4
    Last Post: December 9th, 2013, 10:40 AM
  2. Replies: 1
    Last Post: January 23rd, 2013, 07:29 AM
  3. [SOLVED] How to create a Java generic method, similar to a C++ template method?
    By Sharmeen in forum Object Oriented Programming
    Replies: 3
    Last Post: October 18th, 2012, 02:33 AM
  4. Replies: 3
    Last Post: October 31st, 2011, 12:42 AM
  5. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 11:18 AM