Re: [問題] about StringTokenizer
※ 引述《SagiAB.bbs@ptt.cc (我不是壞人好嗎??)》之銘言:
> import java.util.*;
> import java.io.*;
> class test
> {
> BufferedReader br=nuew BufferedReader(new InputStreamReader(system.in));
> str=br.readLine();
> StringTokenizer tokens = new StringTokenizer(str);
> String temp;
> while(tokens.hasMoreTokens()){
> temp=tokens.nextToken():
> if(temp=="ins")
改成if(temp.equals("ins"))或是
改成if(temp.equalsIgnoreCase("ins"))
試試吧!
> System.out.println("Find ins in the input");
> else
> System.out.print("notFound");
> }
> }
> 我想要從輸入的資料中找找看有沒有 ins這個token 但是雖然有輸入ins這樣的token 程式
> 跑出來的結果 卻還是notFound 已經卡了三天了 希望哪為大大可以幫我解惑 感恩
--
┌─────◆KKCITY◆─────┐ KKBOX◤歌名╱歌手╱歌詞╱專輯◢搜尋
│ bbs.kkcity.com.tw │ ★ http://www.kkbox.com.tw ★
└──《From:61.62.107.41 》──┘ 超過80家唱片公司合法授權 音樂盡情下載
--
討論串 (同標題文章)
完整討論串 (本文為第 3 之 6 篇):