Lecture 14 (Tychonievich) - File Reading

Lecture Date: Friday, February 13

Guest lecturer: Jim Roberts

One Slide Summary - File/URL

  • Scanner can read from more than just the keyboard (System.in), it can also read from files on your computer (File) and files/websites from other computers (URL).
  • We will use the hasNext___() and next___() methods of Scanner to read all the input from Files and URLs in a loop.
  • Lots of things that are out of our control can go wrong when reading from Files/URLs, we will pass the problem on by using throws Exception.

From Lecture: