Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
equals method
:
Мова контенту: English
Русский
Which data structure that implements a Map interface uses an == operator, rather than the equals method for objects comparison?
equals method
What will the following code;s execution display? class V { String s = null; V(String str){ this.s = str; } } public class MyTest { public static void main(String[] args) { V v1 = new V("abc"); V v2 = new V("abc"); System.out.println((v1 == v2) + " " + v1.equals(v2)); } }
equals method
Select all correct statements regarding the concept of relationship between hashCode() and equals(Object o) methods
equals method
What happens after the following code is compiled/executed? 1.import static java.lang.System.*; 2.public class A { 3. public static void main(String[] args){ 4. B b1 = new B("one","two"); 5. B b2 = new B("one", "two"); 6. B b3 = b1; 7. out.println(b1 == b2); 8. out.println(b1 == b3); 9. out.println(b2 == b3); 10. out.println(b1.equals(b2)); 11. out.println(b1.equals(b3)); 12. out.println(b3.equals(b2)); 13. } 14.} class B { public B(String prop1, String prop2){ this.prop1 = prop1; this.prop2 = prop2; } String prop1 = null; String prop2 = null; }
equals method
In accordance with the contract, the hashCode() method should return the same integer value for two objects that are equal according to the equals() method. Is that true?
equals method
What will be printed by the following code? public class Test { static Boolean bo1 = new Boolean("true"); static Boolean bo2 = new Boolean(false); public static void main(String[] args) { Boolean bo3 = new Boolean(bo1); Boolean bo4 = new Boolean("bo2"); System.out.println(bo1.equals(bo3)); System.out.println(bo2.equals(bo4)); } }
equals method
What happens at compile-time and running of the following code? public class Test { public static void main(String[] args) { String s1 = new String("string"); String s2 = new String("STRINg"); StringBuilder sb1 = new StringBuilder("test"); StringBuilder sb2 = new StringBuilder("test"); System.out.println(s1.equalsIgnoreCase(s2) && sb1.equals(sb2) && s2.charAt(s2.length()) == 'g'); } }
equals method
What will be the result of the following code: import java.util.*; public class Test { public static void main(String[] args) { Class c1 = new ArrayList<String>().getClass(); Class c2 = new ArrayList<Integer>().getClass(); System.out.println(c1 == c2); } }
equals method
Select one right option of compiling and running this code. public class Strings { public static void main(String[] args) { String s1 = new String("Bicycle"); String s2 = new String("bicycle"); System.out.println(s1.equals(s2) == s2.equals(s1)); } }
equals method
What will be printed as a result of this code? import java.util.Arrays; class ArraysComparing { public static void main(String...args) { int[] i1[] = {{1,2,3}, {0,0,0}}; int[][] i2 = {{1,2,3}, {0,0,0,}}; int[][] i3 = new int[2][3]; System.arraycopy(i1, 0, i3, 0, i3.length); System.out.println(Arrays.equals(i1, i2)); System.out.println(Arrays.equals(i1, i3)); System.out.println(Arrays.deepEquals(i1, i2)); } }
equals method
← Попередня
1
2
3
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести