zoukankan      html  css  js  c++  java
  • 第六次课堂作业

    class Check{
     public boolean validate(String name,
       String password){
      if(name.equals("xutingfeng")
        &&password.equals("mldn")){
       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="欢迎"+name+"光临!";
      }else{
       str="错误的用户名和密码!";
      }
      return str;
     }
     public void isExit(){
      if(this.info.length!=2){
       System.out.println("输入的参数不正确,系统退出!");
       System.out.println("格式:java LoginDemo02 用户名 密码");
       System.exit(1);
      }
     }
    }
    public class LoginDemo02 {

     /**
      * @param args
      */
     public static void main(String[] args) {
      // TODO Auto-generated method stub
              Operate oper=new Operate(args);
              System.out.println(oper.login());
             
     }

    }

  • 相关阅读:
    【mybatis】02-spring集成
    【Spring】xxAware
    【性能调优】Arthas
    【算法】其他算法(字典树Trie等)
    【多线程】JDK源码类图
    POJ-1251-Jungle Roads
    Prim算法模板
    敌兵布阵-线段树(1)
    hdu-1541-Stars (树状数组)
    母牛生小牛
  • 原文地址:https://www.cnblogs.com/xutingfeng/p/6651621.html
Copyright © 2011-2022 走看看