I started a scenario that has a List variable in the world.class; but I cannot figure out how to add String entries into the list. I keep getting a NullExceptionPointer message. The basic code producing the error is:
What action do I need to take to correct the problem? AnyOne? (Thanx)
I also tried removing first part of line 11: 'boolean itemAdded = '
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.*; public class myWorld extends World { public List<String>listData; public myWorld() { super ( 550 , 330 , 1 ); boolean itemAdded = listData.add( "First item" ); } public void act() { } } |