Last Updated: December 6, 2025
31 quizzes
Store the length of the text in the length variable
int length = message.();Click an option to fill the blank:
Create a new StringBuilder to efficiently build a log message
StringBuilder builder = new ();Click an option to fill the blank:
Print a message to the console when the program starts
.out.println("Java started");Click an option to fill the blank:
Which best describes Java as a programming language?
Which keyword starts the definition of a new class in Java?
Why did Java gain popularity on the early Internet?
Which Java feature directly supports 'write once, run anywhere'?
Which component must you install to both compile and run Java programs?
What is the role of the JRE?
Which statement about the main method in a Java application is true?
Which Java feature automatically reclaims memory for objects that are no longer used?
In the JVM, which component loads .class files into memory?
Which of these is NOT a core OOP principle emphasized by Java?
Why is setting PATH to include the JDK's bin directory useful?
Order the steps to write, compile, and run a simple Java program from the command line.
Drag and drop to reorder, or use the arrows.
Order the stages of how the JVM handles a Java class at runtime.
Drag and drop to reorder, or use the arrows.
What is the output of this code?
1public class Main {
2 public static void main(String[] args) {
3 int a = 5;
4 int b = 3;
5 System.out.println(a + b * 2);
6 }
7}What is the output of this code?
1public class VersionCheck {
2 public static void main(String[] args) {
3 String name = "Java";
4 int year = 1995;
5 System.out.println(name + " was released in " + year);
6 }
7}What is the output of this code?
1public class FeatureCount {
2 public static void main(String[] args) {
3 int features = 3;
4 features++;
5 System.out.println("Features: " + features);
6 }
7}What is the output of this code?
1public class WoraDemo {
2 public static void main(String[] args) {
3 boolean jvmInstalled = true;
4 System.out.println("Can run Java: " + jvmInstalled);
5 }
6}What is the output of this code?
1public class JvmSteps {
2 public static void main(String[] args) {
3 String step1 = "load";
4 String step2 = "verify";
5 System.out.println(step1.toUpperCase() + "-" + step2.toUpperCase());
6 }
7}Find the bug in this Java program that is intended to print Hello, World!
Click on the line(s) that contain the bug.
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!") }}Find the bug preventing this program from running its main method.
Click on the line(s) that contain the bug.
public class Starter { public void main(String[] args) { System.out.println("Starting application"); }}Match each Java component with its primary responsibility.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match each Java history milestone with its description.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the code to define the main entry point of a Java program.
public class App { public static void (String[] ) { System.out.println("Running App"); }}Click an option to fill blank 1:
Complete the code to compile and run a class named Demo from the command line, shown as comments.
// Compile the program// Demo.java// Run the program// DemoClick an option to fill blank 1:
Complete the code to demonstrate automatic garbage collection.
public class GcDemo { public static void main(String[] args) { String temp = new String("Hello"); temp = ; System.out.println(); }}Click an option to fill blank 1:
Complete the code to show a simple object-oriented structure with a method call.
public class Greeter { public void sayHello() { System.out.println("Hello from object"); } public static void main(String[] args) { Greeter g = new (); g.(); }}Click an option to fill blank 1:
Click the line that defines the Java application's entry point.
Click on the line to select.
public class Starter { public static void main(String[] args) { System.out.println("Init"); }}Click the line where the JVM executes the bytecode's behavior (the main action).
Click on the line to select.
public class Lifecycle { public static void main(String[] args) { System.out.println("Bytecode is running"); }}