Answer to Question #183606 in Java | JSP | JSF for Bill

Question #183606

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


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


class Apple

{

int i;

Apple() { i = 3; }

}

class Sample

{

public static void main(String args[])

{

Apple a1 = new Apple();

a1.i++;

System.out.println(a1.i);

}

}


A. 5

B. 4

C. 3

D. 2

E. 1


1
Expert's answer
2021-04-26T10:32:40-0400

Correct answer is "B"


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