public class ObjectTest {
public static void assertVoid(int x) {
System.out.print("assert 1 ");
}
public static int assertInt(int x) {
System.out.print("assert 2 ");
return x;
}
public static void main(
String [] args ) {
int t = 0;
assert t > 1 : assertInt(1);//line 1
System.out.println("complete");
}
}
1 :In line1 t>1 is false:
So will it execute assertInt(1)???
2:If in line1 t>1 is true:
So will it execute assertInt(1)???
How will I get output as "assert 2 complete"?