← Quiz: Java Data Types: all 10 questions
Quiz: Java Data Types · Question 7 of 10
What does this print? (code)
What does this print?
public class Main {
public static void main(String[] args) {
System.out.println(7 % 3 + " " + 7 / 2.0);
}
}
- A.2 3
- B.1 3
- C.2.33 3.5
- D.1 3.5
Answer & explanation
Correct answer: 1 3.5
7 % 3 is the remainder 1. Because 2.0 is a double, 7 / 2.0 is real division: 3.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 →