What is the output of the following code?
public class Main { public static void main(String args[]) { int done = 0; if (!done) {// w w w . j av a 2 s. c om System.out.println("Not done"); } if (done) { System.out.println("done"); } } }
Compile time error
In Java the int type cannot be using as a boolean value.
In Java, these statements must be written like this:
if(done == 0)... // This is Java-style. if(done != 0)... // This is Java-style.