Card 16 / 76: Given the following code segments, which answer is NOT a valid Java implementation because it won’t compile?
A)
int variableA = 10; float variableB = 10.5f; int variableC = variableA + variableB;
B)
int variableA = 10; float variableB = 10.5f; float variableC = variableA + variableB;
C)
byte variableA = 10; float variableB = 10.5f; float variableC = variableA + variableB;
D)
byte variableA = 10; double variableB = 10.5f; double variableC = variableA + variableB;
Answer:
A) int variableA = 10; float variableB = 10.5f; int variableC = variableA + variableB;
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
B, C, and D are incorrect.
These answers all have code that will compile because the code has necessary implicit casts that occur within their expression and assignment statements.
|