What will be the result of compiling and running the following program?.
public class Main { String title;//from w ww . jav a 2s . com boolean published; static int total; static double maxPrice; public static void main(String[] args) { Main main = new Main(); double price; if (true) price = 100.00; System.out.println("|" + main.title + "|" + main.published + "|" + Main.total + "|" + Main.maxPrice + "|" + price+ "|"); } }
Select the one correct answer.
(e)
The program will compile.
The compiler can figure out that the local variable price will be initialized, since the value of the condition in the if statement is true.
The two instance variables and the two static variables are all initialized to the respective default value of their type.