看板 java 關於我們 聯絡資訊
程式要求linked將鍵盤輸入的字串,一一串列。 假設每一行為同一字串,an empety line視為輸入結束。 public static void main(String[] args) throws IOException { Dlist theList = new Dlist();//這是一個double link BufferedReader buf = new BufferedReader( new InputStreamReader(System.in)); System.out.print("keyin a string: "); String strReadLine = buf.readLine(); 我的問題是為何我的while loop, 碰到empty line不會停止, 我是在windows作業系統用Eclipse console測試。 while (strReadLine!=null){ theList.insertLast(strReadLine);//這邊是一個link建立的部分 strReadLine = buf.readLine(); }......程式以下未完 請問該如何修正? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 149.171.8.207
qrtt1:strReadLine!=null || !"".equals(strReadLine.trim()) 08/18 09:18