Home > java > Simple Java Input and Output

Simple Java Input and Output

import java.io.*;

public class SimpleIO
{
 public static void main(String args[])
 {
 try
 {
 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
 System.out.print("what is your name? ");
 String name = reader.readLine();
 System.out.println("hello "+name+", have a nice day");
 }
 catch(Exception e)
 {
 System.out.println("Exception occured");
 e.printStackTrace();
 }
 }
}
Advertisements
Categories: java
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: