Question: Q 2 . Given the following java class on left, what is the output of running the main method on right? Show your work and

Q2. Given the following java class on left, what is the output of running the main method on right? Show your work and draw objects in RAM for partial credit.
[4 Marks]
public class Event {
private int days;
public static int count =0;
public Event(){ this(5); }
public Event(int value){
this.days = value;
count++;
}
public int getDays(){return days; }
public void setDays(int days){
this.days = days;
}
public static void inc(){
count++ ;
}
public Event similar(){
return this;
}
public void change(Event d){
this.days = d.days **2;
count =d. count +2 ;
d. days = count;
}
}
public class TestEvent {
public static void main(String[] args){
Event olymbics = new Event (23);
System.out.println (olymbics.getDays ());
System.out.println (Event. count);
Event[] games = new Event[10];
for (int =15i=0;i
 Q2. Given the following java class on left, what is the

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 Databases Questions!