Computer Applications
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
Answer
Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
Reason — The Integer
class can indeed be used in a program without explicitly importing any package. This is because it is part of the java.lang
package, which is automatically imported in every Java program by default.
Related Questions
The default value of a boolean variable is:
- False
- 0
- false
- True
The method to convert a lowercase character to uppercase is:
- String.toUpperCase( )
- Character.isUppercase( char )
- Character.toUpperCase( char )
- toUpperCase ( )
A student executes the following code to increase the value of a variable ‘x’ by 2.
He has written the following statement, which is incorrect.
x = +2;
What will be the correct statement?
A. x +=2;
B. x =2;
C. x = x +2;- Only A
- Only C
- All the three
- Both A and C
The statement used to find the total number of Strings present in the string array String s[] is:
- s.length
- s.length()
- length(s)
- len(s)