follow

Saturday, 6 July 2013

COMMAND LINE ARGUMENT : JAVA Programming by "Gopal Krishna"

Simple String :


class xyz
{

public static void main(String arg[])
{

System.out.println("enter first no.->"+arg[0]);
System.out.println("enter first no.->"+arg[1]);

String c;

c=arg[0]+arg[1];

System.out.println("sum->"+c);
}
}


String change into integer :


class xyz
{

public static void main(String arg[])
{

System.out.println("enter first no.->"+arg[0]);
System.out.println("enter first no.->"+arg[1]);


int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
int c;
c=a+b;


System.out.println("sum->"+c);
}
}

No comments:

Post a Comment