Hey the names in the program are in portuguese but I think its understandable, if you have any doubt just ask and i'll translate.
So I'm getting a NullPointerException with these. The array Vector_Canais is initialized in the constructor:
public Box(int capacidade) {
Time a = new Time();
Vector_Canais = new Canal[DEFAULT_SIZE];
}
public static void novoCanal() {
Scanner in = new Scanner(System.in);
Cnl = in.nextLine();
Vector_Canais[i] = new Canal(Cnl);
i++;
}
public static String listaCanais(int i) {
return (Vector_Canais[i].getCanal());
}
public static void listaCanais() {
for (int a = 0; a < 100; a++) {
if (Box.listaCanais(a) != null) {
System.out.println(Box.listaCanais(a));
}
}
i is initialized at 0. Any ideas?
Vector_Canais.Vector_Canaisa class or a variable name?Time a = new Time();does nothing - the scope ofais the method and you don't use it, so why define it?