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

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

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

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

    :o)
    0