Ok dude, first you need to use the [*code] and [/code] tags...
// import java.io package and utility packages
import java.io.*;
import java.util.*;
class Stopwatch{
//declared outside of all methods
private long startTime;
public void start() {
GregorianCalendar now = new GregorianCalendar();
startTime = now.getTimeInMillis();
}
public void showElapsedTime() {
GregorianCalendar now = new GregorianCalendar();
long currTime = now.getTimeInMillis();
long difference = (currTime - startTime)/1000;
System.out.print(difference);
System.out.println(" seconds have elapsed.");
}
}
class Irritating_stopwatch {
public static void main(String arg[]) throws Exception {
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
Stopwatch timer = new Stopwatch();
for (int i=9; i>=0; i--){
System.out.println("Hit the Enter key to Start timer");
keyboard.readLine();
timer.start();
System.out.println("Hit the Enter key to Stop timer");
keyboard.readLine();
timer.showElapsedTime();
Counter.decrease();
System.out.print(Counter.getValue());
System.out.println(" More Tries");
System.out.println();
System.out.println("Hit the Enter key to initialize timer");
keyboard.readLine();
}
System.out.println("Due to planned obsolescence, this Stopwatch is no longer perational");
System.out.println();
}
}
class Counter {
private static int callCount = 10;
public static void decrease() {
callCount --;
}
public static int getValue() {
return callCount;
}
}
Basically, just instead of creating an instance of Counter, you just call the methods direct... Counter.decrease(); and so on and so forth.