Sunday, March 16, 2014

Simple Input Output Handling in Java | Example | Source code

Written by Pranshu Bajpai |  | LinkedIn

This code illustrates I/O handling with Java

Source Code



package DICAss;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.*;
/**
 *
 * @author Pranshu
 */
public class DICAss5_IOHandle {
    public static void main(String[] args){
        
        String Str;
        
        BufferedReader BRObj = new BufferedReader
                (new InputStreamReader(System.in));
        
        System.out.print("Give Input : ");
        
        try{
            Str = BRObj.readLine();
            System.out.println("Input was " + Str);
        }
        catch(Exception err){
            System.out.println("Error : " + err);
        }
    }
}

1 comment: