第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

if 條件被忽略

if 條件被忽略

互換的青春 2023-05-10 13:45:11
這段代碼應(yīng)該檢查密碼長度是否合適,但如果密碼長度大于或等于 16,它會(huì)跳過 if 條件并且不打印句子。/* This bit of the coe just checks the length of the password */if (Password.length() >= 8) {    if (Password.length() <= 10) {        System.out.println("Medium length of password");    }}else if (Password.length() < 8) {    System.out.println("Bruv youre asking to be hacked");} else if (i >= 10) {    if (Password.length() <= 13) {        System.out.println("Good password length");    }    /* The part that fails */    else if (Password.length() >= 16) {        System.out.println("Great password length");    }        } 如果密碼長度大于或等于 16,則代碼應(yīng)輸出“Great password length”,但如果密碼長度大于或等于 16,則不會(huì)輸出任何內(nèi)容
查看完整描述

2 回答

?
汪汪一只貓

TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個(gè)贊

if(Password.length() >= 8)并else if(Password.length() < 8)覆蓋所有可能的密碼長度,因此永遠(yuǎn)不會(huì)達(dá)到以下條件。


你應(yīng)該以一種不那么混亂的方式組織你的條件:


if (Password.length() < 8) {

    System.out.println("Bruv youre asking to be hacked");

} else if (Password.length() >= 8 && Password.length() <= 10) {

    System.out.println("Medium length of password");

} else if (Password.length() > 10 and Password.length() <= 13) {

    System.out.println("Good password length");

} else if (Password.length() > 13 && Password.length() < 16) {

    ... // you might want to output something for passwords of length between 13 and 16

} else {

    System.out.println("Great password length");

}

甚至更好


if (Password.length() < 8) {

    System.out.println("Bruv youre asking to be hacked");

} else if (Password.length() <= 10) {

    System.out.println("Medium length of password");

} else if (Password.length() <= 13) {

    System.out.println("Good password length");

} else if (Password.length() < 16) {

    ... // you might want to output something for passwords of length between 13 and 16

} else {

    System.out.println("Great password length");

}


查看完整回答
反對 回復(fù) 2023-05-10
?
婷婷同學(xué)_

TA貢獻(xiàn)1844條經(jīng)驗(yàn) 獲得超8個(gè)贊

嘗試使用:


if (Password.length() >= 8) {

    if (Password.length() <= 10) {

        System.out.println("Medium length of password");

    } else if (Password.length() <= 13) {

        System.out.println("Good password length");

    } else if (Password.length() >= 16) {

        System.out.println("Great password length");

    }

} else if (Password.length() < 8) {

    System.out.println("Bruv youre asking to be hacked");

}


查看完整回答
反對 回復(fù) 2023-05-10
  • 2 回答
  • 0 關(guān)注
  • 170 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)