Java Input/Output
This worksheet explores your understanding of Java's I/O java.io.*
API.
- Write a method determines whether a file exists:
public boolean exists(String name) {
...
}
- Write a method that lists the contents of a directory:
public void ls(String name) {
...
}
- Write a logging method that records a string message to a file,
prefixed by a timestamp:
public void log(String fileName, String msg) {
...
}
- Write a method that reads 4 characters from System.in and prints
them out.
- Write "Hi, Mom!" to a StringWriter and then dump the string to
make sure you wrote it.