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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

b代表的是索引還是什么?

我這樣理解的,數(shù)組里面最后一個(gè)的索引是-1,所以讀到-1就結(jié)束了,可是不知道為什么又轉(zhuǎn)換成16進(jìn)制了,b輸出來(lái)到底是什么內(nèi)容?

正在回答

3 回答

int b;

while((b=in.read())!=-1){

}

這里定義的b 是in.read()讀到有值的話就是整數(shù),并把值賦值給b,然后與-1做比較,不等于-1,說(shuō)明還有值,可以繼續(xù)讀取,如果是-1,里面沒(méi)有值了,退出循環(huán)

1 回復(fù) 有任何疑惑可以回復(fù)我~

?/**

? ? ?* Reads a byte of data from this input stream. This method blocks

? ? ?* if no input is yet available.

? ? ?*

? ? ?* @return? ? ?the next byte of data, or <code>-1</code> if the end of the

? ? ?*? ? ? ? ? ? ?file is reached.

? ? ?* @exception? IOException? if an I/O error occurs.

? ? ?*/

? ? public int read() throws IOException {

? ? ? ? return read0();

? ? }

?說(shuō)的很清楚,the next byte of data, or <code>-1</code> if the end of the

? ? ?*? ? ? ? ? ? ?file is reached.沒(méi)有值是-1,讀的是里面的數(shù)據(jù),不是索引


0 回復(fù) 有任何疑惑可以回復(fù)我~

你可以去看看源碼,里面表示read方法的返回值,源碼里面有寫如果沒(méi)有結(jié)尾,輸出值就不為-1

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

b代表的是索引還是什么?

我要回答 關(guān)注問(wèn)題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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