Please refer to JLS § 3.10.5 or a popular description at http://www.janeg.ca/scjp/lang/strLiteral.html
== returns false 'cause these are different objects: you explicitly create str1. 2009/12/30 Sumant <sumant2...@gmail.com>: > Why I get True for Equals and false for == ? here is the code below... > > > > public class Test12 { > > > public static void main(String[] args) { > String str1=new String("abc"); > String str2="abc"; > System.out.println(str1.equals(str2)); // Returns True > System.out.println(str1==str2); // Returns False > > } > > } > > > -- > You received this message because you are subscribed to the Google > Groups "Java EE (J2EE) Programming with Passion!" group. > To post to this group, send email to > java-ee-j2ee-programming-with-passion@googlegroups.com > To unsubscribe from this group, send email to > java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- Alexey "Alf" Filippov -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en