What will the following program print?
public class Main{ public static void main (String [] args){ int x = 100; int y = 0; //from www .ja v a 2 s .co m if ( x/y ) System .out.println ("Good"); else System .out.println ("Bad"); } }
Select 1 option
Correct Option is : D
You need a boolean in the 'if' condition.
Compiler sees that there is no way x/y can produce a boolean so it generates an error at compile time.