← Quiz: Java Data Types: all 10 questions
Quiz: Java Data Types · Question 1 of 10
What does this print? (code)
What does this print?
public class Main {
public static void main(String[] args) {
System.out.println(10 / 4);
}
}
- A.2.5
- B.2
- C.3
- D.2.0
Answer & explanation
Correct answer: 2
Both are ints, so Java does integer division and drops the .5.
Can you get the rest right without peeking?
Take the timed Quiz: Java Data Types quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →