Bonjour ,
Je suis débutant au programmation avec java.
je veux ajouter une instance du classe ObjectInterpretation a une arraylist des ObjectInterpretation.
il ya une erreur dans la méthode addInterpretation(ObjectInterpretation inter)
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 public class ObjectInterpretation { private String nameOfElement ; private int nbrOfAttributes; private Map<String,String> attributes; public ObjectInterpretation() { super(); // TODO Auto-generated constructor stub } public ObjectInterpretation(String nameOfElement, int nbrOfAttributes, Map<String, String> attributes) { super(); this.nameOfElement = nameOfElement; this.nbrOfAttributes = nbrOfAttributes; this.attributes = attributes; }
Lorsque j'exécute ,il me donne NULL Pointer Exeption.
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 public class ObjectResult { /** The type. */ private Choices type; /** The result. */ private Object result; private ArrayList<ObjectInterpretation> interpretation ; public void addInterpretation(ObjectInterpretation inter) { interpretation.add(inter); }
Arraylist est une collection des objets que je peux ajouter n'importes qu'elle objet non ?
Partager