Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Rufus Williams   on Mar 29 In Java Category.

  
Question Answered By: Grace Ellis   on Mar 29

Yhere are 4 levels of protection in Java:
Public - anyone can access this.
(blank - pakage) - all classes in the same package can access.
Protected - package level + child classes can access.
Private - no one can access except the implementing class.

These levels are based on Object-Oriented Programming principles.

Thus, there is no way to access a Private constructor outside of the
implementing class. The java  compiler (javac) and all IDEs that I know
of forbid it.

Share: