packagecom.test.test1;publicclassStringPool {publicstaticvoidmain(String[] args) {String s1 ="Cat";String s2 ="Cat";String s3 =newString("Cat"); if(s1==s2) {System.out.println("s1 and s2 are pointing to same string "+s1); }else {System.out.println("s1 and s2 are not pointing to same string "+s1); }if(s1==s3) {System.out.println("s1 and s3 are pointing to same string "+s1); }else {System.out.println("s1 and s3 are not pointing to same string "+s1); } }}