*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
The code's output is: E. 0
Comments
Leave a comment