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
j'utilise eclipse
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 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()); } }
Partager