Mon programme donne un résultat "incorrect"
bonjour
en exécutant mon prg ce dernier affiche une valeur faux
au lieu d'afficher mon nom de classe (Eleve)
il m'affiche :
e.toString fournit:java.lang.Object@5cd622e5
veuillez m'aidez svp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
public class Eleve
{
public String toString()
{
String chaine=super.toString();
int index=chaine.indexOf('@');
chaine=chaine.substring(0, index);
return chaine;
}
}
public class TesterObject
{
public static void main(String[] args)
{
Object e = new Object();
System.out.println("e.toString fournit:"+e.toString());
}
} |
j'utilise eclipse