Java String Compare zz

Compare String

http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java

== tests for reference equality.

.equals() tests for value equality.

Consequently, if you actually want to test whether two strings have the same value you should use .equals().

There are however a few situations where you can guarantee that two strings with the same value will be represented by the same object because of String interning. Those cases are specified by the Java Language Specification.

== is for testing whether two strings are the same object.

 

Support Swith case of String?

http://stackoverflow.com/questions/10240538/use-string-in-switch-case-in-java

http://stackoverflow.com/questions/338206/why-cant-i-switch-on-a-string

 

 

 

Compare float

http://stackoverflow.com/questions/1088216/whats-wrong-with-using-to-compare-floats-in-java

 

posted on 2014-11-16 13:20  majia1949  阅读(148)  评论(0编辑  收藏  举报

导航