Labels

Command Line Arguments in Java

class Cal

{    public static void main(String arg[])
{    int x,y;
      x=Integer.parseInt(arg[0]);
      y=Integer.parseInt(arg[2]);
 System.out.print(arg[0]+" "+arg[1]+" "+arg[2]+" "+"= "+(x+y));

}
}


When we execute >Java Cal 10 + 20 
Output>10 + 20 = 30

Comments