Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
constructors
:
Мова контенту: English
Русский
What will be the result of the following code compilation and execution? public class Test { final String s; public Test() { s = "default"; } public Test(String s) { } public static void main(String[] args) { System.out.println(new Test().s); } }
constructors
What will be the result of the following program execution? public class MyThread extends Thread { public void run() { System.out.println("I'm Running!"); } public static void main(String[] args) { System.out.println("About to run thread"); new MyThread("Run, Thread, Run!").start(); } }
constructors
What will be the following program's output? package tutorial.base; public class TypesTutorial { public static void main(String... args) { A alpha = new B(); } } class A { A() { System.out.print("A"); a(); } void a() { System.out.print("a"); } } class B extends A { B() { System.out.print("B"); a(); } void a() { System.out.print("b"); } }
constructors
What is the following program`s execution result? class Tack { static short s = 17; public Tack(short ss) { new Tack(); s *= ss; } public Tack() { ; } } public class Bridle extends Tack { public Bridle(int s) { System.out.println(s + 1); } public static void main(String[] args) { Bridle b = new Bridle(3); } }
constructors
What will be the result of compiling and running the following code: import java.util.List; import java.util.ArrayList; public class Test { public static void main(String[] args) { List<String> values = new ArrayList<String>() { { add("one"); add("two"); add("three"); } }; System.out.print("values: "); for (String value : values) { System.out.print(value + " "); } } }
constructors
Which of the following statements in the given code are true? class A { A(int i) {} } // 1 class B extends A {} // 2
constructors
What happens as a result of compiling and running this code? class Class1 { Class1(int i) { System.out.println("Class1(int)"); } } public class Class2 extends Class1 { Class2(double d) { // 1 this((int) d); System.out.println("Class2(double)"); } Class2(int i) { // 2 System.out.println("Class2(int)"); } public static void main(String[] args) { new Class2(0.0); } }
constructors
What result will give the following code? public class A { public int i = 0; public A() { i = 10; } public static void main(String[] args) { int i = 9; A a = new A(); while(a.i < 10) a.doIt(); //9 } public static void doIt() { i++; //12 System.out.println("Hello"); } }
constructors
Whether the class inherits the constructors of its superclass?
constructors
Given the following code: public class Foo { private Foo() { return this; // 1 } public static Foo get() { return new Foo(); // 2 } public static void main(String[] args) { Foo foo1 = get(); // 3 Foo foo2 = new Foo(); // 4 } } Will there be a compilation error and if so, in what lines?
constructors
← Попередня
1
2
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести