Answer to Question #183605 in Java | JSP | JSF for Phil

Question #183605

*Based on answer choices A-E, what is the code's output?


7. Given the following code, the output is __.


class Apple { public int i=0; }

class Fruits

{

public static void main(String args[])

{

Apple a1 = new Apple();

System.out.println(a1.i);

a1.i++;

}

}


A. 1

B. compiler error

C. runtime error

D. 2

E. 0


1
Expert's answer
2021-04-25T19:51:52-0400

The code's output is: E. 0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog