الرجوع
تسجيل الدخول

What is the output of the following code regarding object memory?

class Counter {
    int count = 0;
}

public class CheckCounter {
    public static void main(String[] args) {
        Counter myCounter = new Counter();
        Counter anotherCounter = new Counter();
        myCounter.count = 1;
        anotherCounter = myCounter;
        System.out.println(anotherCounter.count);
    }
}