title: Best way to read a text file line by line, taking each line and putting it into the code
body: <p>First of all, I am but a lowly web-programmer so have very little experience with actual programming. 
  I have been given a list of 30,000 urls and I am not going to waste my time clicking each one to check if they are valid - is there a way to read through the text file that they are in and have a program check each line? </p>
  
  <p>The code I currently have is in java as really that's all I know so if there's a better language again, please let me know.
  Here is what I have so far: </p>
  
  <pre><code>public class UrlCheck {
  
      public static void main(String[] args) throws IOException {
          URL url = new URL("http://www.google.com");
          //Need to change this to make it read from text file
          try {
              InputStream inp = null;
              try {
                  inp = url.openStream();
              } catch (UnknownHostException ex) {
                  System.out.println("Invalid");
              }
              if (inp != null) {
                  System.out.println("Valid");
              }
          } catch (MalformedURLException exc) {
              exc.printStackTrace();
          }
      }
  }
  </code></pre>