class Check{ public boolean validate(String name,String password){ if(name.equals("lixinghua")&&password.equals("mima")){ return true; }else{ return false; } } } class Operate{ private String info[]; public Operate(String info[]){ this.info = info; } public String login(){ Check check = new Check(); this.isExit(); String name = this.info[0]; String password = this.info[1]; String str = null; if(check.validate(name, password)){ str = "welcome"+name+"!!!"; }else{ str = "error!!!"; } return str; } public void isExit(){ if(this.info.length != 2){ System.out.println("input error"); System.out.println("geshi"); System.exit(1); } } } public class Logindemo { public static void main(String[] args) { // TODO 自动生成的方法存根 Operate oper = new Operate(args); System.out.println(oper.login()); } }