• java第六次作业


    class Check{
     public boolean validate(String name,String password){
      if(name.equals("SZA")
        &&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 demo1 用户名 密码");
       System.exit(1);
      }
     }
    }
    public class demo1 {
     public static void main(String args[]){
      Operate oper= new Operate(args);
      System.out.println(oper.login());
     }

    }

  • 相关阅读:
    Python
    Python
    Python
    Python
    Python
    《The Rise and Fall of Scala》scala的兴衰
    Scala核心编程_第05章_函数式编程
    IntelliJ IDEA scala的源码设置
    Scala核心编程_第04章 程序流程控制
    Scala核心编程_第03章_运算符
  • 原文地址:https://www.cnblogs.com/nibaba/p/6651665.html
Copyright © 2020-2023  润新知