how to return null to int method

otayvete

New Member
iam new to programming.iam wrking on a quiz game software. here i want a count down to be printed as "3,2,1,go...go...go" \[code\] package t2;import java.util.Scanner;import java.util.Timer;import java.util.TimerTask;public class Stopwatch {static int interval;static Timer timer;public static void main(String[] args) { Scanner sc = new Scanner(System.in); int delay = 1000; int period = 1000; timer = new Timer(); interval = 3; System.out.println("3"); timer.scheduleAtFixedRate(new TimerTask() { public void run() { System.out.println(setInterval()); } }, delay, period);} private static final int setInterval() { String go="go...go...go"; if (interval == 2) { timer.cancel(); return go; } return --interval;}}\[/code\]this says that setInterval() has int as return value.if i place \[code\]System.out.print("go");\[/code\]in the place of \[code\]return go;\[/code\] it prints go and prints 1 which is out of requirement. please any buddy can tell me how to do this.
 
Back
Top