Home » JAVA Programming » Modifier Types » Question
  1. What happens if constructor of class N is made private?
    1. Any class can instantiate objects of class N
    2. Inherited class can instantiate objects of class N
    3. classes within the same package as class A can instantiate objects of class N
    4. Objects of class N can be instantiated only within the class where it is declared
    5. None of these
Correct Option: D

If we make any class constructor private, we cannot create the instance of that class from outside the class.



Your comments will be displayed only after manual approval.