Wednesday, 9 October 2013

Program for Command Line Input

//Program for Command Line Input
//Developed by Ahlam Ansari

import java.util.*;
class cmdLineInput
{
    public static void main (String ahlam[])
    {
        int intData;
        String stringData;
        float floatData;
        stringData = ahlam[0];
        intData = Integer.parseInt(ahlam[1]);
        floatData = Float.parseFloat(ahlam[2]);
        System.out.println( "IntData = " + intData + " FloatData = " + floatData + " StringData = " + stringData);
    }
}


/*
C:\Documents and Settings\AHLAM\My Documents\Google Drive\OOPM\Programs>javac cmdLineInput.java

C:\Documents and Settings\AHLAM\My Documents\Google Drive\OOPM\Programs>java cmdLineInput hello 1234 1.2345
IntData = 1234 FloatData = 1.2345 StringData = hello

C:\Documents and Settings\AHLAM\My Documents\Google Drive\OOPM\Programs>
*/

No comments:

Post a Comment