Comment appeler un méthode dans le main?

jakol -  
 jakol -
Bonjour,
je souhaiterais vous poser une question bateau qui me permettra d'avancer
comment appeler correctement la méthode afficher() dans le main? Merci d'avance pour vos réponses:

class toto{

void afficher()
{
System.out.println(""+tab[hauteur]+"");
}

public static void main (String[]args)
{
afficher();
}

3 réponses

Utilisateur anonyme
 
Je crois qu'il faut faire toto.Afficher()
0
jakol
 
merci pour la réponse mais ça ne marche pas
j'ai essayé avec this.afficher()....
0
jakol
 
class toto{

void afficher()
{
System.out.println(""+tab[hauteur]+"");
}

public static void main (String[]args)
{
toto t = new toto();
t.afficher();
}

:o)
0