Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
inner classes
:
Мова контенту: English
Русский
Inner classes in Java
inner classes
What will be displayed after the following code is compiled? class Outer { int outer_x = 100; void test() { for(int i = 0; i < 5; i ++) { class Inner{ void display() { System.out.print("outer_x = " + outer_x + "; "); } } Inner inner = new Inner(); inner.display(); } } } public class InnerClassDemo { public static void main(String args[]) { Outer outer = new Outer(); outer.test(); } }
inner classes
Which line will the first compilation error occur in? public class Test { /* 1 */ public final static class A {} /* 2 */ static private class B {} /* 3 */ abstract static class C {} /* 4 */ static final private class D {} /* 5 */ final public abstract class E {} /* 6 */ static final abstract class F {} }
inner classes
What is the result of the following code execution? public class Main { static class X { static String x = Y.y; } static class Y { static String y = X.x; } public static void main(String[] args) { Y.y = "0"; System.out.println(X.x); } }
inner classes
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); } }
inner classes
What will be the output of the following code? 01: public class Foo { 02: public static void main(String[] args) { 03: class Horse { 04: public String name; 05: public Horse (String s) { 06: name = s; 07: } 08: } 09: Object obj = new Horse("Zippo"); 10: System.out.println(obj.name); 11: } 12: }
inner classes
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: }
inner classes
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(); } }
inner classes
Which of these lines when placed in line 1 will create an instance of class Inner? (select all that apply). class Outer { public class Inner { } Inner getInner(){ return new Inner(); } public Outer() { } } public class Starter { public static void main(String[] args) { //1 } }
inner classes
What will happen after compilation and execution of the following program? class Main { public void method() { static class One { public One() { System.out.println("From one"); } } } public static void main(String... args) { new Main().method(); } }
inner classes
← Попередня
1
2
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести