Wednesday, 9 October 2013

Program for DataInputStream Input

//Program for DataInputStream Input
//Developed by Ahlam Ansari

import java.io.*;

class DISInput
{
    public static void main (String ahlam[]) throws IOException
    {
        int intData;
        String stringData;
        float floatData;
       
        DataInputStream dis = new DataInputStream(System.in);
        stringData = dis.readLine();
        intData = Integer.parseInt(dis.readLine());
        floatData = Float.valueOf(dis.readLine());
        double doubledata=Double.valueOf(dis.readLine());
        System.out.println( "Double "+  doubledata+ "IntData= " + intData + " FloatData= " + floatData + "StringData= " + stringData);
    }
}

/*
C:\Users\Ahlam\Google Drive\OOPM\Programs>javac DISInput.java
Note: DISInput.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

C:\Users\Ahlam\Google Drive\OOPM\Programs>java DISInput
hello
1
1.234
IntData= 1 FloatData= 1.234StringData= hello
*/

No comments:

Post a Comment