why the first code gives output as "true" and second code gives output as "false"?
code 1 ............... String str1="abc"; String str2="abc";
  if (str1==str2)
      System.out.println("true");
  else
       System.out.println("false"); 
code 2
NOTE : Input to both string will be same value ....................
 Scanner sc=new Scanner(System.in);
 System.out.println("enter string 1");
 String String1=sc.next();
 System.out.println("enter string 2");
 String String2=sc.next();
 if(String1==String2)
     System.out.println("true");
 else
     System.out.println("false");
 
    