What is the output of the following program?
1: public class Main { 2: private String brand; 3: private boolean empty; 4: public static void main(String[] args) { 5: Main wb = new Main(); 6: System.out.print("Empty = " + wb.empty); 7: System.out.print(", Brand = " + wb.brand); 8: } 9: }
D.
Boolean fields initialize to false and references initialize to null, so empty is false and brand is null. Brand = null is output.