Probleme avec tableau JAVA

Fermé
sara - 13 déc. 2008 à 23:03
mype Messages postés 2435 Date d'inscription jeudi 1 novembre 2007 Statut Membre Dernière intervention 16 août 2010 - 14 déc. 2008 à 02:35
Bonjour,
voilà je tiens a vous demandez de m'aider sinon se programme va me rendre fou :s SVP c urgent
dans cette methode elle me donne une erreur de type

Exception in thread "main" java.lang.NullPointerException
at Commande.ajouterCmd(Commande.java:14)
at Appli.main(Appli.java:13)


public void ajouterCmd(Article artc, int qte) {
liste[N++] = new ListeCouple(artc, qte);
}
class main
public class Appli {
public static void main(String[] args) {
Stylo S=new Stylo("Sty1", "Stylo bic",1.5,"Stylo bonne qualité","bleu");
Ramette m=new Ramette("Rm1","Ramette HC", 250,"Ramette de papier bonne Qualité",60);
System.out.println(S);
System.out.println(m);
Lots l=new Lots("Lo1",S,10,10);
Lots l1=new Lots("Lo2",m,3,10);
System.out.println(l);
System.out.println(l1);
Commande cmd=new Commande("sara");
cmd.ajouterCmd(l1, 24);//la ligne d erreur avec la suite
cmd.ajouterCmd(l, 30);
cmd.ajouterCmd(S, 24);
cmd.ajouterCmd(m, 30);
System.out.println(cmd);



}
}
A voir également:

3 réponses

hamzafes Messages postés 243 Date d'inscription lundi 26 juin 2006 Statut Membre Dernière intervention 4 mai 2013 54
13 déc. 2008 à 23:53
avez vous déclaré la variable cmd ???

Allah mo3ine
0
oui Commande cmd=new Commande("sara");
0
mype Messages postés 2435 Date d'inscription jeudi 1 novembre 2007 Statut Membre Dernière intervention 16 août 2010 436
14 déc. 2008 à 02:35
t'as instancié liste ?
0