/**
*
*
@author caryt
*
*/
public class test {
/**
*
@param args
*/
static int x[]=new int[15];
public static void main(String[] args) {
// TODO Auto-generated method stub
String t1=new String("caryt");
String t2=new String("caryt");
System.out.println(t1==t2);//比較的是對象的引用
System.out.println(t1!=t2);//比較的是對象的引用
System.out.println(t1.equals(t2));//比較的是對象的spa
}.net
}對象
out: false
true
trueget