What are different type of access modifiers?

Answer Posted / janet

Public: Any thing declared as public can be accessed from
any where.
Private: Any thing declared as private can't be seen
outside of it's class.
Protected: Any thing declared as protected can be accessed
by classes in the same package and subclasses in the other
packages.
Default modifier: can be accessed only to classes in the
same package.

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is static block?

594


State some situations where exceptions may arise in java?

629


What is the most important feature of java? What is an interface?

526


What do you mean by local variable and instance variable?

519


What is java argument list?

522






What do you mean Abstraction in java?

611


Can you give names of Container classes?

1862


Explain a situation where finally block will not be executed?

578


What is the difference between an array and an array list?

508


Explain the reason behind ending a program with a system.exit(0)?

602


Is java type safe?

515


How to solve the problem of generating the unique hash keys with hash function?

1463


Is array a class?

523


How do you declare a destructor in java?

512


What Is Composition?

587