← Quiz: Wrapper Classes and Autoboxing: all 10 questions
Quiz: Wrapper Classes and Autoboxing · Question 10 of 10
What does this print? (code)
What does this print?
public class Main {
public static void main(String[] args) {
System.out.println(Integer.parseInt("101", 2) + Integer.parseInt("11"));
}
}
- A.10111
- B.112
- C.16
- D.5
Answer & explanation
Correct answer: 16
"101" in base 2 is 5, and "11" in base 10 is 11. Both are ints, so 5 + 11 = 16.
Can you get the rest right without peeking?
Take the timed Quiz: Wrapper Classes and Autoboxing quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →