30 lines
443 B
Java
30 lines
443 B
Java
public class Compteur
|
|
{
|
|
private int compte;
|
|
|
|
public Compteur(int start)
|
|
{
|
|
this.compte = start;
|
|
}
|
|
|
|
public void plusUn()
|
|
{
|
|
this.compte++;
|
|
}
|
|
|
|
public String toString()
|
|
{
|
|
return Integer.toBinaryString(this.compte);
|
|
}
|
|
|
|
public static void main(String[] args)
|
|
{
|
|
Compteur test = new Compteur(5);
|
|
while (test.compte<10)
|
|
{
|
|
System.out.println(test.toString());
|
|
test.plusUn();
|
|
}
|
|
}
|
|
}
|