Java programming: public class Foo{ Integer x; public Foo(){ x = 1; y = 2; } y =
ID: 3909083 • Letter: J
Question
Java programming:
public class Foo{ Integer x;
public Foo(){ x = 1;
y = 2;
}
y = y1;
public void doSomethingFoo(){ x = 5;
}
public void doSomethingElse(){ doSomethingFoo();
} }
(1) 8. What occurs during the second line when running the following from a main method: Foo myVar = new Foo(); myVar.doSomethingFoo () A. the x instance variable myVar object changes to 5, B. the data of the object does not change, C. compiler error, D. runtime error, E. it depends. (1) 9. What occurs when running the following from a main method: Bar myVarnew Bar A. w is set to 4, xto 0. y to o. B. w is set to 4, x to 1, y to 2, C. w is set to 4, x to null, y to null, D. none of the above. (1) 10. What happens when the following code is executed in a main method? Foo myVar-new Foo) myVar.doSomethingBar(); A. it works (if doSomethingBar () works), B. compiler error, C. runtime error, D. it depends.Explanation / Answer
8) A 9) Bar class is required to answer this question 10) B 11) Bar class is required to answer this question 12) Bar class is required to answer this question
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.