0
0
Javaprogramming~15 mins

Common wrapper methods in Java - Interactive Code Practice

Choose your learning style8 modes available
ads_clickPractice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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
AparseInt
BvalueOf
CtoString
DintValue
Attempts:
3 left
2fill in blank
medium

Complete 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
AvalueOf
BtoString
CparseInt
DintValue
Attempts:
3 left
3fill in blank
hard

Fix 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
AtoString
BparseBoolean
CvalueOf
DbooleanValue
Attempts:
3 left
4fill in blank
hard

Fill 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
AdoubleValue
BparseDouble
CvalueOf
DtoString
Attempts:
3 left
5fill in blank
hard

Fill 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
AvalueOf
BintValue
CtoString
DparseInt
Attempts:
3 left