I/O Flashcards

1
Q

A path that begins with a drive letter.

A

Absolute Path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Another word for folder

A

Directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A path that does not have a drive letter prefix.

A

Relative Path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a File Class Object in Java?

A

Representation of file and path names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Does creating a file object create a corresponding file on your hard drive?

A

NO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the constructor for a file object take as its argument?

A

A String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Objects created by the JVM to signal that something is wrong in your program.

A

Exceptions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which type of exception requires “exception handling”?

A

Checked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an example of a checked exception?

A

FileNotFoundException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ArrayIndexOutOfoundsException is an example of what kind of exception?

A

Unchecked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the keyword used to confess to the compiler?

A

throws

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where does an exception confession go?

A

Main method declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an issue of using a confession to deal with exceptions?

A

If the exception is thrown your program will crash.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which is the most effective way to deal with a checked exception?

A

try-catch block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are two methods we use to read a text file?

A

hasNext(), hasNextLine()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the default delimiter for hasNext()?

A

White space

17
Q

What method changes the delimiter used by fileReader?

A

useDelimiter(String pattern)

18
Q

What method creates an empty file?

A

createNewFile()

19
Q

When using an absolute path to create a file, what must already exist?

A

The directory the file is going into.

20
Q

If you want to make a directory for putting a file into, what method do you use?

A

getParentFile()

21
Q

What object allows one to write text to a file?

A

PrintWriter