Challenge - 5 Problems
Wrapper Methods Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 code output
intermediate2:00remaining
Output of Integer wrapper method usage
What is the output of the following Java code snippet using Integer wrapper methods?
Java
public class Main { public static void main(String[] args) { Integer num = Integer.valueOf("123"); int result = num.intValue() + Integer.parseInt("77"); System.out.println(result); } }
Attempts:
2 left
💻 code output
intermediate2:00remaining
Output of Double wrapper method usage
What will be printed by this Java code using Double wrapper methods?
Java
public class Main { public static void main(String[] args) { Double d1 = Double.valueOf("10.5"); double d2 = Double.parseDouble("2.5"); System.out.println(d1.doubleValue() * d2); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Output of Boolean wrapper method usage
What is the output of this Java code snippet using Boolean wrapper methods?
Java
public class Main { public static void main(String[] args) { Boolean b1 = Boolean.valueOf("true"); Boolean b2 = Boolean.valueOf("False"); System.out.println(b1 && b2); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Output of Character wrapper method usage
What will this Java code print when using Character wrapper methods?
Java
public class Main { public static void main(String[] args) { Character ch = Character.valueOf('a'); System.out.println(Character.toUpperCase(ch)); } }
Attempts:
2 left
💻 code output
expert2:00remaining
Output of complex wrapper method chaining
What is the output of this Java code using multiple wrapper methods?
Java
public class Main { public static void main(String[] args) { String s = "256"; Integer i = Integer.valueOf(s); Double d = Double.valueOf(i.doubleValue() / 4); System.out.println(d.intValue() + ":" + d); } }
Attempts:
2 left
