What is the output of the following?
public class Main { public static void main(String[] args) { String v = null; while (v == null); v = "v"; System.out.print(v); } }
D.
The first time the loop condition is checked, the variable v is null.
The loop body is empty due to the semicolon right after the condition.
The loop condition keeps running with no opportunity for v to be set.
This is an infinite loop, and Option D is correct.