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

Java 22 | Access Modifiers | Public | Protected | Private | Default смотреть онлайн

As the name suggests access modifiers in Java helps to restrict the scope of a class, constructor , variable , method or data member. There are four types of access modifiers available in java:
Default – No keyword required
Private
Protected
Public

Default: When no access modifier is specified for a class , method or data member – It is said to be having the default access modifier by default.
The data members, class or methods which are not declared using any access modifiers i.e. having default access modifier are accessible only within the same package.

Private : -
The private access modifier is specified using the keyword private.
The methods or data members declared as private are accessible only within the class in which they are declared.
Any other class of same package will not be able to access these members.
Top level Classes or interface can not be declared as private because
private means “only visible within the enclosing class”.
protected means “only visible within the enclosing class and any subclasses”
Hence these modifiers in terms of application to classes, they apply only to nested classes and not on top level classes

Protected : -
The protected access modifier is specified using the keyword protected.
The methods or data members declared as protected are accessible within same package or sub classes in different package.
for example, we will create two packages p1 and p2. Class A in p1 is made public, to access it in p2. The method display in class A is protected and class B is inherited from class A and this protected method is then accessed by creating an object of class B.


package p1;
  
public class A
{
   protected void display()
    {
 System.out.println(“In A");
    }
}

package p2;
import p1.*;
class B extends A {
   public static void main(String args[])
   {  
       B obj = new B();  
       obj.display();  
   }  
      }
Output : - In A

Public : -
The public access modifier is specified using the keyword public.
The public access modifier has the widest scope among all other access modifiers.
Classes, methods or data members which are declared as public are accessible from every where in the program. There is no restriction on the scope of a public data members

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java 22 | Access Modifiers | Public | Protected | Private | Default» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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