Тесты
Язык сайта: Русский
Українська
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
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты