Write a program in java to demonstrate uses of string arg[] of main method or command line argument in java or parseInt() method?

 

class ParseInt

{

                public static void main(String arg[])

                //String arg[] is used to take command line argument

                {

                                int a=Integer.parseInt(arg[0]);

                                int b=Integer.parseInt(arg[1]);

                                System.out.println(a+b);

                }

}

ParseInt() method.PNG

, , , , , , , ,

Leave a Reply