Computer Applications
Assertion (A): In Java, assigning an int value to an Integer object is valid.
Reason (R): Java automatically converts primitive data types to their corresponding wrapper classes, which is called Autoboxing.
Related Questions
Predict the output of the following code snippet:
char ch='B', char chr=Character.toLowerCase(ch); int n=(int)chr-10; System.out.println((char)n+"\t"+chr);Assertion (A): Integer class can be used in the program without calling a package.
Reason (R): It belongs to the default package java.lang.
- 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
The method to convert a String to double is:
- String.toDouble()
- Double.Parsedouble()
- Double.parseDouble(String)
- Double.parseDouble()