24. Consider the following class definition. public class SomeClass private int x = 0; private static int y = 0: public
Posted: Thu May 05, 2022 1:11 pm
24. Consider the following class definition. public class SomeClass private int x = 0; private static int y = 0: public SomeClass(int px) x = px; y++; public void incrementY() { y++; } public void incrementy (int inc) (y += inc; ) public int getY() { return y; } The following code segment appears in a class other than SomeClass. SomeClass first = new SomeClass(10); SomeClass second = new SomeClass (20); SomeClass third = new SomeClass (30); first.incrementY(); second. incrementy (10); System.out.println (third.getY()); What is printed as a result of executing the code segment if the code segment is the first use of a SomeClass object? (A) 0 (B) 1 (C) 11 (D) 14 (E) 30