✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What is the output of the following code snippet?
class MyClass {
static int count = 0;
public MyClass() {
count++;
}
public static int getCount() {
return count;
}
}
public class Main {
public static void main(String[] args) {
MyClass obj1 = new MyClass();
MyClass obj2 = new MyClass();
System.out.println(MyClass.getCount());
}
}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!