La inicialización de la matriz da una excepción de puntero nulo
Estoy aprendiendo Java recientemente y estaba intentando trabajar con clases. Pero no puedo inicializar objetos de matriz
class Tablet
{
String S = null;
void set(String a)
{
S = a;
}
}
public class questions
{
public static void main(String args[])
{
Tablet[] T = new Tablet[6];
for(int i = 0;i<6;i++)
{
T[i].set("111"); // I get null pointer exception here
}
//solution(T,6);
}
}
¿Alguien puede decirme a dónde me voy mal?