Last Updated: May 18, 2026
26 quizzes
A teammate can run existing Java apps but needs to compile HelloShop.java on their laptop. What should they install?
You compile HelloShop.java on one operating system and send HelloShop.class to a colleague using a different operating system. What lets it run there?
After running javac HelloShop.java, you inspect HelloShop.class with javap -c and see instructions like ldc and invokevirtual. What are those instructions?
A tiny program uses String, System.out.println, and ArrayList. Besides the JVM, what must the runtime provide for those names to work?
A service method is called millions of times after the program starts. How is the JVM likely to speed it up?
A corrupted class file claims to pop values from the operand stack in an invalid way. Which JVM stage is responsible for rejecting it before normal execution?
You want to confirm that string concatenation in HelloShop.class became JVM instructions. Which tool from the JDK is designed for inspecting compiled bytecode?
On a machine, java -version works but javac -version fails with a command-not-found message. What is the most likely issue?
Order the steps from editing HelloShop.java to its main method running.
Drag and drop to reorder, or use the arrows.
Order the steps the JVM uses when a method becomes hot during execution.
Drag and drop to reorder, or use the arrows.
What is the output when this class is run?
1public class HelloShop {
2 static {
3 System.out.print("loading ");
4 }
5 public static void main(String[] args) {
6 System.out.print("main");
7 }
8}What bug can make this diagnostic report that Java is unavailable even while the program is running on a JVM?
Click on the line(s) that contain the bug.
public class JavaCheck { public static boolean hasJavaConfigured() { return System.getenv("JAVA_HOME") != null; }}Match each Java platform piece to the role it provides in a typical installation.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match each JVM pipeline component to what it does when a class is run.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the code that asks the current JDK for a compiler and uses it to compile one source file.
javax.tools.JavaCompiler compiler = javax.tools.ToolProvider.();int exitCode = compiler.(null, null, null, "HelloShop.java");Click an option to fill blank 1:
Complete the code that loads a class, finds its main method, and invokes it with an empty String array.
Class<?> appClass = Class.forName("HelloShop");java.lang.reflect.Method main = appClass.("main", String[].class);main.invoke(null, );Click an option to fill blank 1:
Complete the code that reads the runtime name and the virtual machine name from system properties.
String runtimeName = System.getProperty();String vmName = System.getProperty();Click an option to fill blank 1:
Load the String class by its fully qualified name at runtime.
Class<?> stringClass = Class.("java.lang.String");Click an option to fill the blank:
Print the current virtual machine implementation name from the standard system properties.
System.out.println(System.("java.vm.name"));Click an option to fill the blank:
Which line explicitly asks the JVM to load a class by name?
Click on the line to select.
public class LoaderDemo { public static void main(String[] args) throws Exception { System.out.println("before"); Class<?> pluginType = Class.forName("com.myshop.Plugin"); System.out.println(pluginType.getName()); }}A developer coming from C++ writes Java code that creates many short-lived Product objects and asks where to call delete. What is the idiomatic Java answer?
Run the task on a separate thread instead of executing it on the current call stack.
new Thread(task).();Click an option to fill the blank:
Which line prevents the task from running on a new thread?
Click on the line to select.
public class ReportJob { public void launch(Runnable reportTask) { Thread worker = new Thread(reportTask); worker.run(); }}After installing a JDK, a learner's already-open terminal still cannot find java, but a newly opened terminal can. What most likely changed?
Complete the standard entry point method for a simple Java program.
public class HelloShop { public static main( args) { System.out.println("Welcome to MyShop"); }}Click an option to fill blank 1:
This code is saved in a file named HelloShop.java. Why does compilation fail?
Click on the line(s) that contain the bug.
public class Helloshop { public static void main(String[] args) { System.out.println("Welcome to MyShop"); }}