自己在開發一個Java終端控制檯,還有很多不懂得地方,知道的請隨意指點

import java.util.*;

//錄入指令數據對照表
//指令:exit=0;
public class Main{
    public static void maina() {
        System.out.println("[root@JianrongOS]#");
        func();
    }
    //密碼
    public static void passwd() {
        System.out.println("系統已上鎖,請輸入密碼.........");
        for (int xxx=0;xxx<3;xxx++){
            passtf();
            xxx=4;
        }
    }
    //判斷密碼
    public static void passtf(){
        Scanner sr = new Scanner(System.in);
        String pass = sr.next();
        String passwd = "jwjjj313";
        boolean as = passwd.equals(pass);
        if (as == true) {
            System.out.println("歡迎..........");
        } else{
            System.out.println("密碼錯誤...請重試..");
            passwd();
        }
    }

    //作業系統錄入數據判斷函數
    public static void func() {
        Scanner ina = new Scanner(System.in);
        //錄入指令數據
        String ia = ina.next();
        //指令集
        String ica = "exit";
        String icb = "whoami";
        String icc = "os";
        //對比指令
        boolean ra = icb.equals(ia);
        boolean rb = ica.equals(ia);
        boolean rc = icc.equals(ia);
        //作業系統反饋數據
        if (rb == true) {
            System.out.println("注銷中...........");
            return;
        } else if (ra == true) {
            System.out.println("你是管理員(root)");
        } else if (rc == true) {
            System.out.println("JianrongOS_1.0.0" );
            System.out.println("内核版本v1.0");
            System.out.println("作者:Zheng Hon");
            System.out.println("初創時間:臺北時間,2022年,11月,7日,下午3點38分" );
            System.out.println("◇◇◇◇◇◆◆◆◆◆◆◇◇◇◇◇◇◇◇◇◆◆◆◆◆◇◇◇◇◇◇◇◇◇◆◆◆◆◆◆◆◇◇◇◇");
            System.out.println("◇◇◇◇◇◇◇◆◆◇◇◇◇◇◇◇◇◇◇◆◆◆◇◆◆◆◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◇◇◇◇");
            System.out.println("◇◇◇◇◇◇◇◆◇◇◇◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◇◇◇◇◇◇◇◇◆◆◇◇◇◇◆◇◇◇◇");
            System.out.println("◇◇◇◇◇◇◇◆◇◇◇◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◆◇◇◇◇◇◇◇◆◆◆◆◇◇◇◇◇◇◇");
            System.out.println("◇◇◇◇◇◇◇◆◇◇◇◇◇◇◇◇◇◇◆◆◆◇◇◇◆◆◆◇◇◇◇◇◇◇◇◆◆◆◆◆◆◇◇◇◇");
            System.out.println("◇◇◇◇◇◇◇◆◇◇◇◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◆◇◇◇◇◇◇◇◇◇◇◇◆◆◆◇◇◇◇");
            System.out.println("◇◇◇◆◆◇◇◆◇◇◇◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◇◇◇◇◇◇◇◇◆◇◇◇◇◆◆◇◇◇◇");
            System.out.println("◇◇◇◆◆◇◆◆◇◇◇◇◇◇◇◇◇◇◇◆◆◇◇◆◆◆◇◇◇◇◇◇◇◇◆◆◇◇◇◆◆◇◇◇◇");
            System.out.println("◇◇◇◆◆◆◆◆◇◇◇◇◇◇◇◇◇◇◇◇◆◆◆◆◆◇◇◇◇◇◇◇◇◇◆◆◆◆◆◆◆◇◇◇◇");
            System.out.println("◇◇◇◇◇◆◆◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇");
        } else {
            System.out.println("未知指令");
        }
        maina();
    }

    public static void main(String[] args) {
        System.out.println("程式開始運行..................................");
        System.out.println("----------------程式啓動中---------------------");
        System.out.println("------------準備作業系統檔案中-------------------");
        for (int i = 0; i <= 5; i++) {
            System.out.println("-------------------------------------------------------------------------------------");
        }
        System.out.println("此軟體歸Zheng Hon所有,侵權必究");
        passwd();
        maina();
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值