188k views
5 votes
Among these expressions, which is(are) of type String?

(a) "0"
(b) "ab" + "cd"
(c) '0'
(d) Both (A) and (B) above
(e) (A), (B) and (C) above.

User Raj Rusia
by
7.8k points

1 Answer

6 votes

Final answer:

Among the given expressions, (a) "0" and (b) "ab" + "cd" are of type String.

Step-by-step explanation:

The expressions (a) "0" and (b) "ab" + "cd" are of type String. In expression (a), the double quotes indicate that the value is a String literal. In expression (b), the concatenation of the two String literals 'ab' and 'cd' results in a String. On the other hand, expression (c) '0' is of type char because it is enclosed in single quotes. Therefore, the correct answer is (d) Both (a) and (b) above.

User Dave Huang
by
8.5k points