Computer Applications
Assertion (A) Class initialisation is the explicit initialisation of class fields to values.
Reason (R) Each class field explicitly initialises to a value via a class field initialiser.
- Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
- Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
- Assertion (A) is true and Reason (R) is false.
- Assertion (A) is false and Reason (R) is true.
Java Constructors
8 Likes
Answer
Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
Reason — Assertion (A) is true as constructors are invoked at the time of instance creation which assign values to various class fields. Reason (R) is true as constructors initialize values to class fields. Thus, Reason (R) explains Assertion (A).
Answered By
5 Likes
Related Questions
This access specifier can be accessed only by the subclass in other package or any class within the same package.
- protected
- private
- public
- default
Which of these data type value is returned by equals() method of string class?
- char
- int
- boolean
- All of these
Read the following text and choose the correct answer:
Java constructor overloading is a technique in which a class can have any number of constructors that differ in parameter list. The compiler differentiates these constructors by taking into account the number of parameters in the list and their type.
Why do we use constructor overloading?
- To use different types of constructors.
- Because it's a feature provided.
- To initialise the object in different ways.
- To differentiate one constructor from another.
Assertion (A) JVM is a Java interpreter loaded in the computer memory as soon as Java is loaded.
Reason (R) JVM is different for different platforms.- Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
- Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
- Assertion (A) is true and Reason (R) is false.
- Assertion (A) is false and Reason (R) is true.