Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
arrays
:
Мова контенту: English
Русский
What is the result of the following program execution? public class Main { public static void main(String[] args) { String testString = "This is a test string."; String[] resultArray = testString.split(" "); System.out.println(resultArray.length); } }
arrays
What happens when the following code is compiled? public class Performer { public static void main(String[] args) { if (args instanceof Object) { // 1 System.out.println("yes"); } else { System.out.println("no"); } } }
arrays
What is the following code execution result? String data[]; data = {"one", "two", "three"}; System.out.println(data[1]);
arrays
What happens when you compile and run the following code? public class Test { static int[] arrInstance = new int[100]; public static void main(String[] args) { byte[] arrLocal = new byte[100]; for (int i = 0; i < 100; i++) if (arrInstance[i] != arrLocal[i]) { throw new IllegalStateException("error"); } } }
arrays
What will be the result of the code: import java.util.Arrays; import java.util.Iterator; import java.util.List; public class Test { public static void main(String[] args) { String[] str = new String[] { "1", "2", "3" }; List list = Arrays.asList(str); for (Iterator iterator = list.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); iterator.remove(); } System.out.println(list.size()); } }
arrays
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)); } }
arrays
Which of the following statements are true given the following code: String a = new String("hello"); String b = new String(a); String c = a; char[] d = { 'h', 'e', 'l', 'l', 'o' };
arrays
What will be shown in console after following code compiles (choose all numbers that will be printed): public class ArrTest { public static void main(String[] X){ print(new int[] { 1, 2, 3, 4 }); print(new Long[] { 1l, 2l, 3l, 4l }); } static void print(Long i){ System.out.print(1); } static void print(Object i){ System.out.print(2); } static void print(Object... i){ System.out.print(3); } static void print(long[] i){ System.out.print(4); } static void print(Integer... i){ System.out.print(5); } static void print(Number... i){ System.out.print(6); } }
arrays
Given the following code, which of the numbered lines should be commented, to have the code compile and run successfully? Select the appropriate line numbers. class Parent { } class Child extends Parent { } class Child2 extends Parent { } public class ArrayTest { public static void main(String[] args) { Parent[] arr1 = new Child[3]; arr1[0] = new Parent(); //1 arr1[1] = new Child(); //2 arr1[2] = new Child2(); //3 arr1[3] = new Child(); //4 Child2[] arr2 = {new Child2(), new Child2(), new Child2()}; add(arr2); } public static void add(Parent[] arr) { arr[0] = new Parent(); //5 arr[1] = new Child(); //6 arr[2] = new Child2(); //7 arr[3] = new Child2(); //8 } }
arrays
How a method "sort" can be declared, when there is an example of its call: sort(new int[3]); Specify all appropriate options
arrays
← Попередня
1
2
3
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести