Home
>>     < >




In-class notes for 01/04/2018

CS 284 (MCA), Interim 2018

Submitted questions on assignments and technology

Lab: File I/O in Java

  • Example files FileCopy.java, FileCopyDriver.java

    • FileCopy.java

      • thoroughly checking all the things that can go wrong with file copy operations

      • abort() method for handling exceptions uniformly

    • FileCopyDriver.java

      • interactively obtaining file names

      • promoting to BufferedReader class, which offers a readLine() method returning a String

  • PrintStream, the type of System.out (has print methods as well as inherited write methods)

  • Flushing output (OutputStream.flush() or Reader.flush())

File I/O exercise

  • File input/output, character conversions

Looking ahead

Installing React Native

To study for quiz

Java programming in Labs 1 and 2
  • You may bring one side of one page of notes.

  • Lab 1 topics include: exceptions (try/catch); reading integers from standard input using System.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 or CopyFile.java.




< >