Would someone please explain the correct answer to this question? 4. Does every Java variable use a data type? a. No---only numeric variables use data types. b. No---data types are optional. c. Yes---all variables are of the same data type. d. Yes---each variable must be declared along with its data type. The answer is b. Could someone give an example? Thank you!
Sounds like a poor choice of words. Every variable declaration requires a type and a name. Perhaps the test author defines "data type" as referring to Java's "reference types", arrays and classes, and not the primitive data types like int.