File handling in Java
Lesson 2 of 11 in Coddy's File Handling in Java course.
In Java, you can handle files using the File class located in the java.io package:
import java.io.File;To start handling a file, specify the file name or path to create a File object:
File dataFile = new File("data.txt");Now, you can start making operations on dataFile! (We will see later on…)
Challenge
EasyIn the main method, create a File object with the file named "coddy.txt"
Try it yourself
class Main {
public static void main(String[] args) {
// Write code here
// Don't change below this line
System.out.println("Done");
}
}