Shuttleu
09-22-2010, 05:53 PM
well i just started learning java again and i forgot nearly everything
anyway so far i have this
class First {
int x = 2;
}
public class Main {
public static void main(String[] args)
{
First[] testing = new First[5];
testing[2].x = 5;
System.out.println(testing[2].x);
}
}
it compiles fine but when i run it i get
Exception in thread "main" java.lang.NullPointerException
at Main.main(Main.java:11)
any ideas are welcome
~shut
anyway so far i have this
class First {
int x = 2;
}
public class Main {
public static void main(String[] args)
{
First[] testing = new First[5];
testing[2].x = 5;
System.out.println(testing[2].x);
}
}
it compiles fine but when i run it i get
Exception in thread "main" java.lang.NullPointerException
at Main.main(Main.java:11)
any ideas are welcome
~shut