i. New due date - Monday, November 28, 10pm
ii. No consultants scheduled over break
1. I might be reachable by e-mail, but don’t
rely on it
iii. You should redownload the jar file (you might
have to make some slight changes to your code)
i. java.io.File;
ii. java.util.Scanner;
1. new Scanner(File f);
2. new Scanner(URL u.openStream());
iii. java.net.URL;
i. java.io.PrintWriter;
i. throws
ii. Java.io.FileNotFoundException;
iii. java.io.IOException;
i. Default delimiter - whitespace
ii. The book’s discussion about options for the
parameter here is not very satisfying
1. In general it accepts something called
regular expressions
a. These are like patterns
b. We won’t worry about the details in this
class
2. But, you can also provide a specific string
that you want Java to use as a delimiter for the items in the Scanner
iii. Simple example…
1. Specify String for delimiter, such as “,” or
“:”
a. With delimiter “,”, the following:
“Hello,goodbye” is parsed into “Hello” and “goodbye”
2. This overrides the default – whitespace will
no longer separate parts of the input if you specify a delimiter
3. Can be more than one character long, such as
“…“ or “, “
a. If you use more than one character, it must
match the string exactly
b. So, with the delimiter “…”, the following
will be returned as one String: “a, b. c d..e”
iv. useDelimiter(“”) – read one character at a
time
i. boolean Character.isDigit()
1. Is this character a number between 0 and 9?
ii. boolean Character.isWhiteSpace()
1. Is this a whitespace character?
iii. String
string.trim()
1. Removes whitespace from beginning and end of
string
a. This includes newlines
iv. int Integer.parseInt()
1. What if it’s not an int? Or even if it contains whitespace…
i. new Scanner(String s);
ii. Use hasNext(), next(), etc
i. String[] string.split(String delim);
1. Returns an array containing the individual
pieces of the String according to the delimiter we pass in
2. like with useDelimiter, we specify what to
split around
a. Another example of a regular expression,
where we can also use something simpler
3. We’ll usually use something like “ “ or “,”
i. Automating – batch file, shell scripts, etc
1. Basically, when you have to do something a
bunch of times, with different arguments – easier to automate than do it by
hand