Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

java preogram output

public class IfElse{
    public static void main(String argv[]){

        IfElse ie = new IfElse();
        ie.go(argv);

    }
    public void go(String[] sa){
    if(sa.length ==0){
        System.out.println("No parameter supplied");
    }else{
        String s = sa[0];
        if(s.equals("true")){
        System.out.println("OK");
        }else if(s.equals("false")){
        System.out.println("Not OK");
        }else{
        System.out.println("Invalid command parameter");
        }
    }

    }
}


I was trying above example from link
http://www.jchq.net/certkey/0201certkey.htm

I was trying to get output 'OK' but could not get it. What change I have to make to output 'OK'. Please advise. Any links, ideas, resources,sample code highly appreciated. thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to provide commad line argument
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial