Computer Applications
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.
Java Constructors
25 Likes
Answer
A constructor returns initial value.
Reason — A constructor has no return type as its primary function is to set initial values of data members at the time of creation of an object.
Answered By
16 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.
A constructor is always:
- private
- protected
- secure
- public
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.