Java Program to find maximum of three values from command line argument …

This program is to find maximum of three values from command line argument.
class max3
{              public static void main(String args[])
                {
                                int a,b,c;
                                a=Integer.parseInt(args[0]);
                                b=Integer.parseInt(args[1]);
                                c=Integer.parseInt(args[2]);
                                if(a>b && a>c)
                                {             
                                System.out.println(“a is max “);
                                }
                                else if(b>a && b>c)
                                {
                                System.out.println(“b is max “);
                                }
                                else
                                {
                                System.out.println(“c is max “);
                                }
                }
}

Add Comment