Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
public, private, protected
:
Мова контенту: English
Русский
Is it possible to refer to a private method of some class from another instance of the same class?
public, private, protected
What will happen as the result of the following code compilation? 1. package mail; 2. 3. interface Box { 4. protected void open(); 5. void close(); 6. public void empty(); 7. }
public, private, protected
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 {} }
public, private, protected
Which of the following statements are true?
public, private, protected
Which access modifiers allow access to the field/method of a public class to other classes that are in the same package?
public, private, protected
Does the following code will compile if both classes are declared in Test.java? //Test.java public class Car{ public String myCar = "Ferrari" ; } public class Test{ public static void main(String ... args){ Car myCar = new Car(); System.out.println(myCar.myCar); } }
public, private, protected
How can a class inheritance be prohibited (top-level classes are considered)?
public, private, protected
What will be printed out as a result of the following code execution? public class Main { private static class A1 { private String test() { return "A1"; } } public static class A2 extends A1 { public String test() { return "A2"; } } public static class A3 extends A2 { public String test() { return "A3"; } } public static void main(String ... arg) { A1 a1 = new A1(); System.out.println(a1.test()); a1 = new A2(); System.out.println(a1.test()); a1 = new A3(); System.out.println(a1.test()); } }
public, private, protected
There are two classes: package pak1; import pak2.B; public class A { void doAThings() { System.out.print("A "); } public static void main(String[] args) { A a = new B(); a.doAThings(); } } and package pak2; import pak1.A; public class B extends A { public void doAThings() { System.out.println("I'm B ;)"); } } What will happen when you try to compile both classes and run the main-method?
public, private, protected
What happens as a result of the following code execution? public class Test { class A { private void act(){}; } class B extends A { protected void act(){}; } class C extends B { public void act(){}; } class D extends B { void act(){}; } public static void main(String[] args){ A obj = new Test().new D(); obj.act(); } }
public, private, protected
← Попередня
1
2
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести