Card 31 / 76: Which of the following statements contain literal values?
A)
int maxHorsePower = 170;
B)
float currentHorsePower = (float) maxHorsePower;
C)
float idleHorsePower = ((float) currentHorsePower) / 10);
D)
System.out.println("Current HP: " + currentHorsePower);
Answer:
A) int maxHorsePower = 170;
C) float idleHorsePower = ((float) currentHorsePower) / 10);
D) System.out.println("Current HP: " + currentHorsePower);
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
The 170 in A,
the 10 in C,
and the "Current HP: " in D
are all literals.
B is incorrect because this statement does not contain any values that are literals.
|