Prev Next

Java / Access Modifiers

1. Can a class be declared as private?

Posted on Apr 1, 2016 by Senthil Kumar.

A class cannot be declared private.

Read full answer

2. Can a class be declared protected?

Posted on Apr 1, 2016 by Senthil Kumar.

No. A class cannot be protected.

Read full answer

3. Can an interface be declared protected?

Posted on Apr 1, 2016 by Senthil Kumar.

No. An interface cannot be protected.

Read full answer

4. What are the applicable access specifier for a class/interface/abstract class?

It can be public or no access specified(default access).

Read full answer

5. Can we run a Java program without main method?

No. However until Java 7, we can execute by using static blocks....

Read full answer

«
»

Comments & Discussions