In Java, reading text from a web page isn't much more difficult than reading from a text file! Download the following code and get it to compile.
import java.net.URL; import java.util.Scanner; public class SimpleWebInput { public static void main(String[] args) throws Exception { URL mcool = new URL("http://cs.leanderisd.org/mitchellis.txt"); Scanner webIn = new Scanner( mcool.openStream() ); String one = webIn.nextLine(); webIn.close(); System.out.println(one); } }
Mr. Mitchell is cool.
Assignments turned in without these things will receive half credit or less.
mitchellis.txt
contains two lines. Add in code
to read in and display the second line as well.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.