Java MT 3

Card Set Information

Author:
gianni11
ID:
207395
Filename:
Java MT 3
Updated:
2013-03-15 00:26:42
Tags:
MT
Folders:

Description:
MT 3
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user gianni11 on FreezingBlue Flashcards. What would you like to do?


  1. What are the steps to writing to a file?
    Files have to be opened

    – Data is then written to the file, or read from the file.

    – The file must be closed prior to program termination.
  2. How do you create an instance of the PrintWriter class?
    PrintWriter outputFile = new PrintWriter("StudentData.txt");
  3. The PrintWriter class allows you to write data to a file using the _______ & _________ methods,
    print

    println
  4. What does the println method do?
    place a newline character after thewritten data.
  5. What does the print method do?
    writes data without writing the newline character.
  6. How do you pass an IO exception up the line?
    need a throws clause in the method header

    public static void main(String[] args) throws IOException
  7. How dod you create an instance of a scanner?
    Scanner keyboard = new Scanner(System.in);
  8. Once an instance of Scanner is created, data can be read using the same methods that you have used to _______________
    read keyboard input (nextLine, nextInt, nextDouble, etc).

    String str = inputFile.nextLine();
  9. The Scanner __________ method will return true if another item can be read from the file.
    hasNext()
  10. What Will Read until the end of the file?

    while (___________()){
    inputFile.hasNext

What would you like to do?

Home > Flashcards > Print Preview