Problème de java.lang.NullPointerException
bonjour,
j'ai le code suivant qui me renvoi l'erreur java.lang.NullPointerException sur la
ligne majt1();
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public class Main {
public static NewJFrame F1 ;
public static String [] t1;
public static int i;
public static void main(String[] args) {
NewJFrame F1 = new NewJFrame();
F1.Setvalue(10,"3");
F1.setVisible(true);
F1.Setvalue(25,"7");
t1 = new String[81];
majt1();
/* Maj du tableau t1 avec les valeurs du formulaire */
public static void majt1() {
for ( i = 0;i<80;i++)
{
t1[i] = F1.Getvalue(i);
}
}
} |
Alors que je n'ai plus l'erreur si je fais :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class Main {
public static NewJFrame F1 ;
public static String [] t1;
public static int i;
public static void main(String[] args) {
NewJFrame F1 = new NewJFrame();
F1.Setvalue(10,"3");
F1.setVisible(true);
F1.Setvalue(25,"7");
t1 = new String[81];
for ( i = 0;i<80;i++)
{
t1[i] = F1.Getvalue(i);
}
} |
Quelqu'un a une idée de pourquoi ça ne marche pas ?
Merci.