RUVIDEO
Поделитесь видео 🙏

10A. Java Basics for Selenium - Access Modifiers - Interview Questions

What access modifiers can be used for class?
We can use only two access modifiers for class public and default.
public: A class with public modifier can be visible
1) In the same class
2) In the same package subclass
3) In the same package non-subclass
4) In the different package subclass
5) In the different package non-subclass.
default: A class with default modifier can be accessed
1) In the same class
2) In the same package subclass
3) In the same package non-subclass
4) In the different package subclass
5) In the different package non-subclass.

Explain what access modifiers can be used for methods?

We can use all access modifiers public, private, protected and default for methods.
public: When a method is declared as public it can be accessed
1) In the same class
2) In the same package subclass
3) In the same package non-subclass
4) In the different package subclass
5) In the different package non-subclass.

default: When a method is declared as default, we can access that method in
1) In the same class
2) In the same package subclass
3) In the same package non-subclass

We cannot access default access method in
1) Different package subclass
2) Different package non-subclass.

protected:
When a method is declared as protected it can be accessed
1) With in the same class
2) With in the same package subclass
3) With in the same package non-subclass
4) With in different package subclass
It cannot be accessed non-subclass in different package.

private: When a method is declared as private it can be accessed only in that class.

It cannot be accessed in
1) Same package subclass
2) Same package non-subclass
3) Different package subclass
4) Different package non-subclass.

What all access modifiers are allowed for top class?
For top level class only two access modifiers are allowed.
public and default.
If a class is declared as public it is visible everywhere. If a class is declared default it is visible only in same package.
If we try to give private and protected as access modifier to class we get the below compilation error.
Illegal Modifier for the class only public, abstract and final are permitted.
Explain what access modifiers can be used for variables?

We can use all access modifiers public, private, protected and default for variables.

public: When a variable is declared as public it can be accessed
1) In the same class
2) In the same package subclass
3) In the same package nonsubclass
4) In the different package subclass
5) In the different package non subclass.

default: When a variable is declared as default, we can access that method in
1) In the same class
2) In the same package subclass
3) In the same package non subclass

We cannot access default access variables in
4) Different package subclass
5) Different package non subclass.

protected: When a variables is declared as protected it can be accessed
1) With in the same class
2) With in the same package subclass
3) With in the same package non subclass
4) With in different package subclass

It cannot be accessed non subclass in different package

private: When a variable is declared as private it can be accessed only in that class.

It cannot be accessed in
1) Same package subclass
2) Same package non subclass
3) Different package subclass
4) Different package non subclass.

Can a class declared as private be accessed outside its package?
Not possible.
Can a class be declared as protected?
The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected, however methods and fields in an interface cannot be declared protected.
What is the access scope of a protected method?
A protected method can be accessed by the classes within the same package or by the subclasses of the class in any package.
If a variable is declared as private, where may the variable be accessed?
A private variable may only be accessed within the class in which it is declared.
What do you understand by private, protected and public?
These are accessibility modifiers. Private is the most restrictive, while public is the least restrictive. There is no real difference between protected and the default type (also known as package protected) within the context of the same package, however the protected keyword allows visibility to a derived class in a different package.
What modifiers may be used with an inner class that is a member of an outer class?
A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
If a class is declared without any access modifiers, where may the class be accessed?
A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «10A. Java Basics for Selenium - Access Modifiers - Interview Questions», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.