I've seen other post on this forum, that the solution was an unitialized String
.
Why is this returning a null pointer exception
, since I'm initializing the string, and the array of Foo
?
class Foo
{
public String Name = "foobar";
public int Score = 0;
};
class Bar
{
private Foo[] timerScore = new Foo[10];
//....
private void xpto()
{
timerScore[0].Name = "test"; //<---null pointer exception.why?!
timerScore[0].Score = 30;
}
}