Question: class Counter { private int seconds = 0 ; public void addOne ( ) { seconds + + ; } public void subtractOne ( )
class Counter
private int seconds;
public void addOne
seconds;
public void subtractOne
seconds;
public int currentCount
return seconds;
class Main
public static int doStuffint x Counter a
x;
aaddOne;
return xacurrentCount;
public static void mainString args
int x;
int y;
Counter a new Counter;
aaddOne;
ydoStuffxa;
System.out.printlna acurrentCount x x y y;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
