Skip to content

Instantly share code, notes, and snippets.

@tormaroe
Created March 9, 2011 12:38
Show Gist options
  • Save tormaroe/862114 to your computer and use it in GitHub Desktop.
Save tormaroe/862114 to your computer and use it in GitHub Desktop.
import java.io.*;
class MyFirstProgram {
/** Print a hello message */
public static void main(String[] args) {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String name = "Instructor";
System.out.print("Give your name: ");
try {
name = in.readLine();
}
catch(Exception e) {
System.out.println("Caught an exception!");
}
System.out.println("Hello " + name + "!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment