go to previous page   go to home page   go to next page        


The blanks are filled, below.

Checking Command Line Arguments

Of course, you can use any names for the arguments of the catch{} clauses. The blocks have to be in the given order since FileNotFoundException is a child class of IOException Also, the blocks should actually do something.

    . . . . 
catch(  FileNotFoundException nfx  )

catch(  IOException iox  )

All that remains is to check the command line arguments. The command line looks like this:

java copyBytes sourceFile to destinationFile

Here is the part of the program that checks that the command line is correct:

public static void main ( String[] args ) 
  DataInputStream  instr;
  DataOutputStream outstr;
  if ( _________________ _____ _________________  )
    System.out.println("java CopyBytes source to destination");
  . . .

Sadly, there are three blanks which must be filled. Here is a list of possible blank-fillers:


Fill the blanks. The error message is written out when the command line is incorrect.