Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to convert the string "123" to an integer using a wrapper method.
Java
int number = Integer.[1]("123");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to convert the integer 456 to a string using a wrapper method.
Java
String text = Integer.[1](456);
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the code to convert the string "true" to a boolean value.
Java
boolean flag = Boolean.[1]("true");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to create a Double object from a string and get its primitive double value.
Java
Double d = new Double("3.14"); double value = d.[1](); // get primitive boolean check = Double.[2]("3.14") > 3.0;
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to convert a string to an Integer object, get its int value, and convert it back to string.
Java
Integer obj = Integer.[1]("789"); int num = obj.[2](); String str = Integer.[3](num);
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
