Quality Testing

Quality is delighting customers

What is Access Modiefier? How many Access Modiefiers are present?

About Access Modiefier and how many Access Modiefiers are present

Views: 228

Reply to This

Replies to This Discussion

Access Modifiers : they will give you the visibility of the method for the project, to the class, to the methods and to the variables.

Access Modifiers can be given to classes, methods and variables as well.

 Methods in Java:

 Accessmodifier                 Returntype                        methodname ()args{

          Public                               void                                   what we give

 

// Body of the method //

        (line of  code)

Access Modifier in Java : There are 13 types of access modifiers . We learn for selenium only 4 of them.

 

  1. Public: When we use this modifier . this modifier has highest visibility. It can viewed throughout the project.
  2. Private: We can’t access this method through out or can only access the method only in that class.
  3. Default: We created a method and didn’t mention any modifier, then it considers a default. It can be accessed throughout the project.
  4. Protected :

 

There are four type of access modifier

1. Default: i t is visible only within its own package 

2. Public:  i t is visible only within its own package and class

3. Protected: within same class and same package

4. Private: within the class or outside class using inheritance.

Hi,

To write a professional code for a quality assurance company you need to write a quality code using access modifiers.

The access modifiers specifies accessibility or scope of a data member, method, constructor or class.

There are 4 types of java access modifiers:

1. private
2. default
3. protected
4. public

However, In C# there are 5 different types of Access Modifiers.

1. public: There are no restrictions on accessing public members.
2. private: Access is limited to within the class definition. This is the default access modifier type if none is formally specified
3. protected: Access is limited to within the class definition and any class that inherits from the class
4. internal: Access is limited exclusively to classes defined within the current project assembly
5. protected internal: Access is limited to the current assembly and types derived from the containing class. All members in current project and all members in derived class can access the variables.

Hi, 

They are four access modifier which allow classes to access object/method/member variable in Java

  1. public
  2. private
  3. protected
  4. default

Ask more queries in q2a of software testing professionals.

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service