Declarations and Access Control Logic

© examsiri.com
Question : 7 of 29
 
Marks: +1, -0
Click the Exhibit button.
public class A
{
  private int counter=0;
  public static int getInstanceCount()
{
   return counter;
  }
  public A()
{
   counter++;
  }
}

Given this code from Class B:
1. A a1 = new A();
2. A a2 = new A();
3. A a3 = new A();
4. System.out.println(A.getInstanceCount());
What is the result?
Go to Question: