Engineering Full Stack Apps with Java and JavaScript
What will be the output of the following program?
public class TestClass{ public static void main(String args[ ] ){ int i = 0 ; boolean bool1 = true ; boolean bool2 = false; boolean bool = false; bool = ( bool2 & method1(i++) ); //1 bool = ( bool2 && method1(i++) ); //2 bool = ( bool1 | method1(i++) ); //3 bool = ( bool1 || method1(i++) ); //4 System.out.println(i); } public static boolean method1(int i){ return i>0 ? true : false; } }
Select 1 option
A. It will print 1.
B. It will print 2.
C. It will print 3.
D. It will print 4.
E. It will print 0.