Null pointer exception
I am new to java and would really appreciate some help. I am working on a form design to capture data and save it to a server where I can reload it and manipulate the data when required. I have designed the form and am able to save/reload it locally. The problem I am having is with a choice on my form. I have set up the correct criteria in init{
Choice details = new Choice() ;
details.addItemListener(this);
details.add("Option 1");
details.add("Option 2");
details.add("Option 3");
details.select(0);
add(details);
though when I attempt to read the selection using either position = details.getSelectedIndex(); OR detailsOutput = details.getSelectedItem(); in public void itemStateChanged(ItemEvent e)
I keep getting null pointer exception and cannot access the data, either as an int nor a string. In init I have used details.Select(0); but cannot understand where I am going wrong. My only previous programming experience was with pascal and cobol many moons ago, so my problem may be simple but I am losing more and more hair by the minute.
Much thanks in advance.
Jim

