Is "C:\cai\cs151" a relative or an absolute path name?

Answer:

Absolute. (It is the absolute path name of a directory).

Improved File Copy Program

The exists() method tests if a file exists. Do this when a program is about to create a file, and you don't want to destroy a previous file of the same name. Here is a start on a program:

import java.io.*;
class CopyBytes
{
  public static void main ( String[] args ) 
  {
    DataInputStream  instr;
    DataOutputStream outstr;

    if ( args.length != 3 || !args[1].toUpperCase().equals("TO") )
    {
      System.out.println("java CopyBytes source to destination");
      return;
    }

    File inFile  = new File( args[0] );
    File outFile = new File( _____________ );

    if ( outFile._____________ )
    {
      System.out.println( args[2] + " already exists");
      return;
    }

    if ( ____inFile._____________ )
    {
      System.out.println( args[0] + " does not exist");
      return;
    }

    .  .  .  .  

  }
}

Now the program tests that: (1) the destination file does not already exist, and that (2) the source file does exist.

QUESTION 6:

Fill in the blanks.