+ 1

why we cant use interger or float at the place of string in main

public static void main(string []Arg)

26th Aug 2016, 10:08 AM
KUMAR HARSH
KUMAR HARSH - avatar
2 Réponses
+ 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]);
26th Aug 2016, 1:42 PM
WPimpong
WPimpong - avatar
- 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"); } }
26th Aug 2016, 11:00 AM
Vijaya Bharathy V R
Vijaya Bharathy V R - avatar