boolean equals(String Str)
Compares this string to the specified object.
boolean equalsIgnoreCase(String anotherString)
Compares this String to another String, ignoring case considerations.
Compares this string to the specified object.
boolean equalsIgnoreCase(String anotherString)
Compares this String to another String, ignoring case considerations.
解决方案 »
- 各位大神,帮忙看下了!Ajax不能读xml
- 雪地跪求 在线等 url传参数的乱码问题..什么方法都试了..
- 关于用jsp页面不通过form提交也能把参数传到后台的问题!!!
- jsp装扮博客怎么实现? 有源代码吗?
- 想请教一个关于可能是时间有关上的问题,请大家给点思路,请说的详细点,小弟初学者,必解贴,谢了
- 数组转换成字符串,有什么方法吗?100的给
- 使用过邮件服务器james的请进(JavaMail+James)
- 文件存放目录
- request.getParameter()方法,如何区分……
- 怎么实现两个FRAME之间的通讯???(就像此论坛)
- 有关Applet和Servlet通讯的怪事。
- email中中文出现乱码怎么办???
要用str1.equals(str2)
因为String是引用类型的,不是基本数据类型,所以它们的比较是使用地址和值(相当于C中的指针)来比较的,因为它们是不同的对象,有不同的地址,所以str1!=str2永远都是true。而str1==str2永远是false。如果你中想比较它们的数值是否相等就使用str1.equals(str2)。使用==或者!=是对象的比较,它们为真的条件是:不仅要求是同一对象,而值也要求相等。