Java scanner and Method set in Array Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:16) -


import java.util.scanner; public class main {      public static void main(string[] args) {         tech[] std=new tech[5];         int i;         for(i=0;i<5;i++)         {             system.out.println("enter name of student");                 string name;                 scanner scanin = new scanner(system.in);                name = scanin.nextline();                scanin.close();              std[i].setname(name);             system.out.println(std[i].name);         }      }  } 

exception in thread "main" java.lang.nullpointerexception @ main.main(main.java:16)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -