Computer Applications
A constructor is always:
- private
- protected
- secure
- public
Java Constructors
23 Likes
Answer
public
Reason — A constructor is always public because it is always called from outside the class while creating an object.
Answered By
13 Likes
Related Questions
For which purpose a constructor is used?
- To initialise the instance variables
- To provide the instance variables
- To organise the instance variables
- To simplify the instance variables.
Which of the following statements is false?
- A constructor has same name as class name.
- A constructor returns initial value.
- A constructor is called while creating an object.
- A constructor is not used for arithmetical and logical operations.
Which constructor initialises data members with default values?
- Parameterized constructor
- Non-parameterized constructor
- Copy constructor
- Default constructor
What is not true for a constructor?
- It is used only to initialize the data members.
- It returns a unique value.
- It may not use parameter.
- None of the above.