Challenge - 5 Problems
Method Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 code output
intermediate2:00remaining
Output of a method with parameters
What is the output of the following Java program?
Java
public class Test { public static int multiply(int a, int b) { return a * b; } public static void main(String[] args) { System.out.println(multiply(3, 4)); } }
Attempts:
2 left
💻 code output
intermediate2:00remaining
Return type and output
What will be printed when this Java code runs?
Java
public class Demo { public static String greet() { return "Hello!"; } public static void main(String[] args) { System.out.println(greet()); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Method overloading output
What is the output of this Java program with overloaded methods?
Java
public class Overload { public static int add(int a, int b) { return a + b; } public static double add(double a, double b) { return a + b; } public static void main(String[] args) { System.out.println(add(2, 3)); System.out.println(add(2.0, 3.0)); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Void method and output
What will be printed when this Java program runs?
Java
public class VoidTest { public static void printMessage() { System.out.println("Hi there!"); } public static void main(String[] args) { printMessage(); System.out.println("Done"); } }
Attempts:
2 left
💻 code output
expert2:00remaining
Method recursion output
What is the output of this Java program using recursion?
Java
public class Recursion { public static int factorial(int n) { if (n <= 1) return 1; else return n * factorial(n - 1); } public static void main(String[] args) { System.out.println(factorial(4)); } }
Attempts:
2 left
