What is the result?

Given:

1. public class BuildStuff {
2. public static void main(String[] args) {
3. Boolean test = new Boolean(true);
4. Integer x = 343;
5. Integer y = new BuildStuff().go(test, x);
6. System.out.println(y);
7. }
8. int go(Boolean b, int i) {

9. if(b) return (i/7);
10. return (i/49);
11. }
12. }

What is the result?

Given:

1. public class BuildStuff {
2. public static void main(String[] args) {
3. Boolean test = new Boolean(true);
4. Integer x = 343;
5. Integer y = new BuildStuff().go(test, x);
6. System.out.println(y);
7. }
8. int go(Boolean b, int i) {

9. if(b) return (i/7);
10. return (i/49);
11. }
12. }

What is the result?

A.
7

B.
49

C.
343

D.
Compilation fails.

E.
An exception is thrown at runtime.



Leave a Reply 0

Your email address will not be published. Required fields are marked *