adplus-dvertising
frame-decoration

Question

What happens if constructor of class A is made private?

a.

Any class can instantiate objects of class A

b.

Objects of class A can be instantiated only within the class where it is declared

c.

Inherited class can instantiate objects of class A

d.

classes within the same package as class A can instantiate objects of class A

Posted under Java Programming

Answer: (b).Objects of class A can be instantiated only within the class where it is declared

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What happens if constructor of class A is made private?

Similar Questions

Discover Related MCQs

Q. All the variables of interface should be?

Q. What is true of final class?

Q. How many copies of static and class variables are created when 10 objects are created of a class?

Q. Can a class be declared with a protected modifier.

Q. Which is the modifier when there is none mentioned explicitly?

Q. Arrays in Java are implemented as?

Q. Which of these keywords is used to prevent content of a variable from being modified?

Q. Which of these cannot be declared static?

Q. Which of these methods must be made static?

Q. String in Java is a?

Q. Which of these method of String class is used to obtain character at specified index?

Q. Which of these keywords is used to refer to member of base class from a subclass?

Q. Which of these method of String class can be used to test to strings for equality?

Q. Which of these is the method which is executed first before execution of any other thing takes place in a program?

Q. What is the process of defining more than one method in a class differentiated by parameters?

Q. Which of these can be used to differentiate two or more methods having the same name?

Q. Which of these data type can be used for a method having a return statement in it?

Q. Which of this method is given parameter via command line arguments?

Q. Which of these data types is used to store command line arguments?

Q. How many arguments can be passed to main()?