Which of the following are true? (Choose all that apply)
4: short v = 5; 5: int v2 = 5.6; 6: String name = "Scruffy"; 7: v.length(); 8: v2.length(); 9: name.length();
B, D, E.
Option A (line 4) compiles because short is an integral type.
Option B (line 5) generates a compiler error because int is an integral type, but 5.6 is a floating-point type.
Option C (line 6) compiles because it is assigned a String.
Options D and E (lines 7 and 8) do not compile because short and int are primitives.
Primitives do not allow methods to be called on them.
Option F (line 9) compiles because length()
is defined on String.