Bonjour j'apprend a utiliser la classe timer mais j'ai un problème dans un petit programme tout simple qui a pour but d'afficher un chiffre s'incrementant toutes les secondes jusqu'a 10 :
Voilà le problème que j'ai :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.*; public class Prin { public static void main(String[] args) { Timer timer; int delai = 1000; int nb = 10,inc = 1; timer = new Timer(delai,this); while (nb<=10) { timer.start(); System.out.println(inc); inc++; } } }Je ne comprend pas très bien les erreurs que j'ai faites.Cannot use this in a static context
The method start() is undefined for the type Timer
Merci d'avance pour votre aide.
Partager