+ 1
Why is error generating in this code?
class mo { public static void main(String ab[]) { int a=Integer.parseInt(ab[0]); int b=Integer.parseInt(ab[1]); int c=a+b; System.out.println(c); } }
6 Réponses
0
if you run this program in ide you don't have any parameters in main class and there is no 0 or 1 element
0
and you need one more }
0
Yup one more}
0
But this code is running properly in other systems
0
you need to start this code on command line as follows
java po 20 12
0
Thanks