public class OperatorsAndExpressions{
void equalsMethodl(){
String s1=new String(“how are you”)
String s2=new String(“how are you”)
System.out.println(s1=s2)
}
public static void main(String args[]){
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions();
//用于复合类型数据的“= =”运算符
OperAndExp.equalsMethod1();
}
}
结果是输出false,s1和s2不是比较的常量池相等吗?这点又有些模糊了... |
|