In-class notes for 01/04/2018
CS 284 (MCA), Interim 2018
Read Graphics page in Java "text" area; then submit at least one reading question by tonight "midnight".
First quiz tomorrow afternoon, 1pm; review questions in morning. Topics below
This session: Lab 2: File I/O
Submitted questions on assignments and technology
Lab: File I/O in Java
Example files
FileCopy.java
,FileCopyDriver.java
-
thoroughly checking all the things that can go wrong with file copy operations
abort()
method for handling exceptions uniformly
-
interactively obtaining file names
promoting to
BufferedReader
class, which offers areadLine()
method returning aString
-
PrintStream
, the type ofSystem.out
(hasprint
methods as well as inheritedwrite
methods)Flushing output (
OutputStream.flush()
orReader.flush()
)
File I/O exercise
File input/output, character conversions
Looking ahead
Read Graphics page in Java "text" area; then submit at least one reading question by noon on next class meeting day
Installing React Native
To study for quiz
Java programming in Labs 1 and 2You may bring one side of one page of notes.
Lab 1 topics include: exceptions (
try/catch
); reading integers from standard input usingSystem.in
,Integer.parseInt()
, command-line arguments, object-oriented programming (e.g.,static
), Java syntax, etc.Lab 2 topics include basics of file I/O.
Modify and identify elements of an example Java program, such as
TryIO.java
orCopyFile.java
.
< >