title: Read a string from a file, skip the rest of the line after a certain character
body: <p>I am currently learning how to use Java. I am trying to read a file using the scanner class and I want to read the file but ignore the rest of the line after a certain character eg #. say the file reads</p>
  
  <pre><code> P5 #ignorethis
   #ignorealso
   123 123 123 #thisneedstogo
   355 255 345 #alsothis goes
  </code></pre>
  
  <p>the file I am trying to read has comments after the symbol '#' and they last till the end of the line. I want to read the strings of the file, whilst ignoring '#' and everything after that.
  Any help would be much appreciated, thanks :)</p>