Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 970 Bytes

11.控制流5.md

File metadata and controls

42 lines (25 loc) · 970 Bytes

11.控制流(Control Flow)

练习2:写一个门禁系统,能够给对特工信息进行识别,每个特工有一串特殊的编号,输入系统后,度过编号正确,则识别出特工身份,如果编号错误,则出发时警报。

package our_first_package;

public class AgentNum {
	public static void main(String[] args) {
		int AgentCode = 888;
		String ScreenShows;
		if (AgentCode==888){
            ScreenShows="欢迎你,发财特工!";
        }
        else if(AgentCode==666) {
            ScreenShows="OMG!是你啊,顺顺特工!";
        }
        else if(AgentCode==000){
            ScreenShows="老大你好!";
        }
        else{
            ScreenShows="来人啊!报警啦!";
        }
          
		System.out.println(ScreenShows);	
	}
}

乐学偶得版权所有 公众号:乐学Fintech 正版视频课程 网易云课堂:乐学偶得