Computer Applications
Which of the following is a valid Integer constant:
i. 4
ii. 4.0
iii. 4.3f
iv. "four"
- Only i
- i and iii
- ii and iv
- i and ii
Values & Data Types Java
ICSE Sp 2024
22 Likes
Answer
Only i
Reason — Integer constants represent whole number values only. Thus, 4 is an integer constant. 4.0 is a double constant, 4.3f is a float constant while "four" is a String constant.
Answered By
13 Likes
Related Questions
Name the package that contains wrapper classes:
- java.lang
- java.util
- java.io
- java.awt
Constructor overloading follows which principle of Object Oriented programming?
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
The method compareTo() returns …………… when two strings are equal and in lowercase :
- true
- 0
- 1
- false
Assertion (A): In Java, statements written in lower case letter or upper case letter are treated as the same.
Reason (R): Java is a case sensitive language.
- 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