Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
access modifiers
:
Мова контенту: English
Русский
What is the result of the following code compilation and execution? public class Test extends A { public int i = 1; public static void main(String... args) { System.out.print(new Test().i); System.out.print(new A().i); System.out.print( ((A)new Test()).i ); } } class A { public int i = 2; }
access modifiers
Which access modifiers allow access to the field/method of a public class to other classes that are in the same package?
access modifiers
What will be the result of the work of the following program? class A { public A() { System.out.print("A "); } } class B { public B() { System.out.print("B "); } } public class Test { private A objA = new A(); private static B objB = new B(); public Test() { System.out.print("Test "); } public static void main(String[] args){ System.out.print("Main "); new Test(); } }
access modifiers
What access modifiers are allowed for the class if he is the only one in the file?
access modifiers
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?
access modifiers
How would you change declaration of function foo to ensure that a function foo is only accessible by classes defined in the package com.quizful ? package com.quizful class Foo { def foo = {...} }
access modifiers
Access modifiers
access modifiers
← Попередня
1
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести