Чем отличаются задания строк в виде String x = "qwerty"; String y = "qwerty"; — от — String a = new String ("qwerty"); String b = new String ("qwerty"); При сравнении результаты разные... String a = new String ("qwerty"); String b = new String ("qwerty"); if (a==b) {System.out.println("a==b");} else {System.out.println("a!=b");} // a!=b String x = "qwerty"; String y = "qwerty"; if (x==y) {System.out.println("x==y");} else {System.out.println("x!=y");} //x==y