Coding examples
Capturing

import java.io.*;
public class read_a_string {
    public static void main (String[] args) {
        System.out.print("Please enter your name: ");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String strName = null;
        try {
                strName = br.readLine();
            }
                catch (IOException ioe) {
                System.out.println("I had a problem reading your name");
                System.exit(1);
            }
        System.out.println("Hello there " + strName);
    }
}
8/28/2012 09:39:48 am

Great blog, I just created an account here too.

Reply



Leave a Reply.