title: Java Text Input: How to ignore lines starting with certain characters in them?
body: <p>I basically want to ignore certain lines with characters in them, like if there's a line</p>
  
  <pre><code>// hello, i'm bill
  </code></pre>
  
  <p>I want to ignore that line while reading it because it contains the character "//". How can I do that? I tried method skip(), but it gives me errors. </p>
  
  <pre><code>public String[] OpenFile() throws IOException {
  
    FileReader reader = new FileReader(path);
    BufferedReader textReader = new BufferedReader(reader);
  
    int numberOfLines = readLines();
    String[] textData = new String[numberOfLines];
    int i;
  
    for (i=0; i&lt;numberOfLines; i++) {
        textData[i] = textReader.readLine();
    }
  
    // close the line-by-line reader and return the data
    textReader.close();
    return textData;
  }
  
  int readLines() throws IOException {
    FileReader reader = new FileReader(path);
    BufferedReader textReader = new BufferedReader(reader);
    String line;
    int numberOfLines = 0;
  
    while ((line = textReader.readLine()) != null) { 
      // I tried this:
      if (line.contains("//")) {
        line.skip();  
      }
      numberOfLines++;       
    }    
    reader.close();  
    return numberOfLines;
  }
  </code></pre>
  
  <p><strong>Update: HERE's MY MAIN METHOD:</strong></p>
  
  <pre><code>try{
   ReadFile files = new ReadFile(file.getPath());
   String[] anyLines = files.OpenFile();
   }
  </code></pre>