221k views
4 votes
Consider the following data types in Java :

I. Int
II. Boolean
III. Double
IV. String
V. Array.
Which of them are simple/primitive data types?
(a) Both (I) and (II) above
(b) (I), (II), (III) and (IV) above
(c) (I), (II) and (III) above
(d) (II) and (III) above
(e) All (I), (II), (III), (IV) and (V) above.

User Fgregg
by
8.4k points

1 Answer

5 votes

Final answer:

In Java, the primitive data types among the options given are Int, Boolean, and Double. String and Array are not primitive data types; String is a class representing character sequences, and Array is a collection of elements.

Step-by-step explanation:

Out of the options given, the primitive or simple data types in Java are Int and Boolean. A primitive data type is predefined by the language and is named by a reserved keyword. Java has eight primitive data types: byte, short, int, long, float, double, boolean, and char. Int represents a 32-bit integer, and Boolean represents true or false values. On the other hand, Double is also a primitive data type, which is a double-precision 64-bit IEEE 754 floating point.

While String and Array are not primitive data types; String is a class that defines objects that are sequences of characters, and Array is a collection of similar type elements accessed by their index. Therefore, the correct answer to the question is (c) (I), (II), and (III) above.