Computer Applications
Assertion: A class can have multiple constructors.
Reason: Multiple constructors are defined with same set of arguments.
- Assertion is true, Reason is false.
- Both assertion and Reason are false.
- Both assertion and Reason are true.
- Assertion is false, Reason is true.
Java Constructors
2 Likes
Answer
Assertion is true, Reason is false.
Reason — A class can have multiple constructors, this is called constructor overloading. However, multiple constructors cannot have the same set of arguments because that would cause ambiguity. Each constructor must have a different number or type of parameters.
Answered By
3 Likes
Related Questions
The AMB hotel gives the amount to be paid by the customer as an integer, which of the following Math method rounds off the bill in decimals to an integer?
- Math.round()
- Math.pow()
- Math.ceil()
- Math.abs()
Identify which of the following leads to an infinite loop.
- for(i = 10; i != 0; i--)
- for(i = 3; i <= 30; i += 3)
- for(i = 1; i >= 1; i++)
- for(i = 1; i >= 0; i--)
Assertion: An array can store elements of different data types.
Reason: An array is a user-defined data type with multiple values of the same data type but a different memory index.
- Assertion is true, Reason is false.
- Both assertion and Reason are false.
- Both assertion and Reason are true.
- Assertion is false, Reason is true.
Which of the following statement is an example for explicit typecasting?
- int amount = 45;
- int amount = 24*24;;
- int amount = Integer.parseInt("45")
- int amount = (int)45.75;