KnowledgeBoat Logo
|

Computer Applications

What condition(s) a function must specify in order to create objects of a class ?

Java Constructors

5 Likes

Answer

Every time an object is created, the constructor is automatically invoked. If the function creating the object, does not have access privilege for the constructor, it cannot be invoked for that function. Thus, the object cannot be created by such function.

Therefore, it is essential for a function to have access privilege for the constructor in order to create objects of a class.

Answered By

4 Likes


Related Questions