Answers to Self-Review Exercises

15.1

a) False. These three streams are created for you when a Java application begins executing.

b) True.

c) True.

d) False. Text files are human readable in a text editor. Binary files might be human readable, but only if the bytes in the file represent ASCII characters.

e) True.

f) False. Class Formatter contains method format, which enables formatted data to be output to the screen or to a file.

15.2

a) Scanner inOldMaster = new Scanner(Paths.get("oldmast.txt"));

b) Scanner inTransaction = new Scanner(Paths.get("trans.txt"));

c) Formatter outNewMaster = new Formatter("newmast.txt");

d)

Account account = new Account();account.setAccount(inOldMaster.nextInt());account.setFirstName(inOldMaster.next()); ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.