Question: ` ` ` public class MyClass { private static int count = 0 ; private int id; public MyClass ( ) { count + +

```
public class MyClass {
private static int count =0;
private int id;
public MyClass(){
count++;
id = count;
}
public static int getCount(){
return count;
}
public int gelld(){
return id;
}
public static void main(String[] args){
MyClass obj1= new MyClass();
MyClass obj2= new MyClass();
System.out.printIn(obj1.getld());
System.out.printIn(obj2.getld());
System.out.printIn(MyClass.getCount());
}
}
```
What will be the output of the abowe Java program?
` ` ` public class MyClass { private static int

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!