Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
static keyword
:
Мова контенту: English
Русский
What will be the output of the following code? class Clazz { { System.out.println("non-static init"); } public static void main(String a[]) { System.out.println("main"); Clazz ob1 = new Clazz(); } static { System.out.println("static init"); } }
static keyword
What will the following code print out? public class Test { private void division(int a, int b) { int result = a / b; System.out.println(result); } public static void main(String[] args) { division(2, 0); } }
static keyword
Will this code be compile? 1: public class InnerExample { 2: public class Inner { 3: static final int x = 3; 4: static int y = 4; 5: } 6: static class Nested { 7: static int z = 5; 8: } 9: }
static keyword
What will be the result of compiling and running the following code: public class Test { public static void main(String[] s) { class Inn { static { System.out.print("Static "); } void m() { System.out.print("inner "); } } new Inn().m(); } }
static keyword
What will be the result of compilation and execution of the following code? public class Test { enum Enum { ONE("oneInfo"), TWO("twoInfo"), THREE("threeInfo"); private static String info = ""; //1 Enum(String info) { this.info = info; //2 } public static String getInfo() { return info; } } public static void main(String[] args) { System.out.println(Enum.TWO.getInfo()); // 3 } }
static keyword
What will be the result of compiling and running the following code: public class Test { private static String name = "Duke"; public static void main(String[] args) { System.out.println("Hello "); System.out.println(getTest().name); } private static Test getTest(){ return null; } }
static keyword
What will be the result of compilation and execution of the following code: public class Test { static int b = Test.a; static int a = 3; static { System.out.println("a=" + a + ", b=" + b); } } Choose all that apply.
static keyword
Choose correct constructor bodies to be inserted at line (1). class Base { public Base(String s) { System.out.println("Base(" + s + ")"); } } class Sub extends Base { private static final String CLASS_DUMMY_STRING = "CLASS_DUMMY_STRING"; private final String INSTANCE_DUMMY_STRING = "INSTANCE_DUMMY_STRING"; public Sub() { //(1) } private static String getClassString() { return CLASS_DUMMY_STRING; } private String getInstanceString() { return INSTANCE_DUMMY_STRING; } }
static keyword
What will be the result of compilation and execution of the following code? import java.util.*; public class Test { void a1(Object... i){ System.out.println("[Object... i]"); } void a1(Integer... i){ System.out.println("[Integer... i]");; } public static void main(String... args){ a1(new Integer[19]); } }
static keyword
What will be the result of compilation and execution of the following code: 01: public class DecTest { 02: 03: private static int x = getY(); 04: private static int y = 5; 05: 06: private static int getY(){ 07: return y; 08: } 09: 10: public static void main(String[] args) { 11: System.out.println(x); 12: } 13: }
static keyword
← Попередня
2
3
4
5
6
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести