+ 1
why we cant use interger or float at the place of string in main
public static void main(string []Arg)
2 Answers
+ 2
it is a rule of java. so that JVM can start the program. If you need number as input, you can cast from string.
e.g.
int i = Integer.parseInt(args[0]);
- 1
we can
then other will be:
public class numbers
{
public static void main (int a, int b)
{
//int a=0;
//int b=0;
int sum=a+b;
System.out.println ("the sum of two numbers is="+sum");
}
}