0

I've been trying to get this working for far too long. I am to use an array of strings to construct an array of "sentence" classes by using the string as part of the constructor. Can anyone help me out? public class FileConverter {

private final String input;
private final String output;
private boolean inputEncrypted;
private ArrayList<Sentence> y;

public FileConverter(String input, String output, boolean inputEncrypted) {                
    this.input = input;
    this.output = output;
    this.inputEncrypted = inputEncrypted;
}

// this method creates an array of sentences from input
public boolean readInput() {
    String[] x = input.split("\\.");        

   for(String x1:x){
       Sentence a = new Sentence(x1);
        y.add(a);
   }
    return false;
}

y.add(a) is giving me a null pointer exception. I've tried a few different ways to do this and I can't seem to figure it out.

Brian Upward
  • 59
  • 1
  • 8

0 Answers0