I try to compare two strings in Java as the following:
        String a="String 1";
        String b = "String 1";
        if(a==b)
        {
            System.out.println("Equal");
        }
        else
            System.out.println("Not Equal");
        System.out.println("----------------");
        if(a.equals(b))
            System.out.println("Equal");
        else
            System.out.println("Not Equal");
I got warning message in NetBeans when I use a==b. Why it like this? But, when I use equals, it has no problem.
 
    