Which, inserted at line 12, creates the output myInt = 42?

Given:
5. class Foo {
6. public int fooInt = 6;
7. }
8.
9. public class Bar {
10. static int myInt = 7;
11. public static void main(String [] args) {
12. // insert code here
13. System.out.println(“myInt = ” + myInt);
14. }
15. }
Which, inserted at line 12, creates the output myInt = 42?

Given:
5. class Foo {
6. public int fooInt = 6;
7. }
8.
9. public class Bar {
10. static int myInt = 7;
11. public static void main(String [] args) {
12. // insert code here
13. System.out.println(“myInt = ” + myInt);
14. }
15. }
Which, inserted at line 12, creates the output myInt = 42?

A.
Foo f = new Foo;
myInt = myInt * f.fooInt;

B.
myInt = myInt * f.fooInt;

C.
myInt = myInt * fooInt;

D.
Foo f = new Foo();
myInt = myInt * f.fooInt;

E.
Foo f = Foo();
myInt = myInt * fooInt;

F.
Foo f = new Foo();
myInt = myInt * fooInt;



Leave a Reply 0

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