- 积分
- 18
- UID
- 8775
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
I encountered a very strange problem in my java program.
part of the source code:
... ...
String token = st.nextToken();
System.out.println("token="+token);
boolean abc = false;
if (token=="asdf") abc = true;
System.out.println("abc="+abc);
The result displayed in the console is:
token=asdf
abc=false
It's really strange! Since the first result has demonstrated that the value of token is "asdf", how can the statement (token=="asdf") be false? |
|