Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a method that takes one integer parameter.
Java
public void printNumber([1] number) {
System.out.println(number);
}🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to call the method with the correct argument.
Java
printNumber([1]);🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the method declaration to accept two parameters: an integer and a string.
Java
public void display([1] number, String text) { System.out.println(number + ": " + text); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to declare a method that takes a double and a boolean parameter.
Java
public void setValues([1] value, [2] flag) { System.out.println(value + ", " + flag); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to declare a method that takes a String, an int, and a boolean parameter.
Java
public void update([1] name, [2] age, [3] active) { System.out.println(name + ", " + age + ", " + active); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
