Java: I Can't pass a string variable into array?
I'm new to Java, very very new, and I have encountered a hair raising problem: I can't seem to pass the value of a string variable into a string array. It's very frustrating when I poll the array and get null as far as the eye can see. The code follows:
public class SntncArray extends Applet implements ActionListener
TextField theSntnc = new TextField(60);
Button pressMe=new Button("parse to array");
String sntncArray= new String;
public void init()
public void actionPerformed(ActionEvent pressMe)
fillIt=new String (theSntnc.getText());
public void brkSntnc(String sntnc)
System.out.println("Array at "+wrdCnt+" is:"+sntncArray[wrdCnt]);
Basically I'm trying to write a class which accepts input (in the form of an applet) and breaks the words in the input into an array, one array slot for each word. So far, as I said before, sntncArray[wrdCnt]=sntnc.substring(0,x-1); always equals null, in spite of the fact that sntnc.substring(0,x-1); is a valid string. I'm clearly missing something very obvious, but I can't figure out what. I know that strings are objects and not primitives and so I can't use them as primitives (I think) but how can I pass the value of a given string into an array? I even tried making a string to hold the value of sntnc.substring(0,x-1); ("passer") and tried sntncAray[wrdCnt]=passer; but with the same result:Null. Any assistance is greatly appreciated. Greatly greatly. VERY Greatly greatly.