Hello I am learning to use the timer class but I have a small problem in a very simple program that aims to display a number incremented every second up to 10:
Code:
import java.util .*;
Print public class (
public static void main (String [] args) (
Timer timer;
int delay = 1000;
int nb = 10, inc = 1;
timer = new Timer (delay, this);
while (nb <= 10)
(
timer. start ();
System. Out. System.out.println (inc);
inc + +;
)
)
)
That is the problem I have:
Can not use this in a static context
The method start () is undefined for the type Timer
I do not understand very well the mistakes I made. Please help me to sort out my problem.!!
Bookmarks