What will be the output of the program?public class Test { public static int y; public static void foo(int x) { System.out.print('foo '); y = x; } public static int bar(int z) { System.out.print('bar '); return y = z; } public static void main(String [] args ) { int t = 0; assert t > 0 : bar(7); assert t > 1 : foo(8); /* Line 18 */ System.out.println('done '); } } - Study24x7
Social learning Network
study24x7

Default error msg

Login

New to Study24x7 ? Join Now
Already have an account? Login
13 Mar 2023 01:25 PM study24x7 study24x7

What will be the output of the program?

public class Test { public static int y; public static void foo(int x) { System.out.print("foo "); y = x; } public static int bar(int z) { System.out.print("bar "); return y ...

See more

A

bar

B

bar done

C

foo done

D

Compilation fails

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles