Why am I getting the error: Incompatible Type
So I am going through the Java tutorial on Oracle' site and I have hit another bump.
Code:
import java.io.File;
import java.io.*;
import java.util.Date;
public class Test {
public static void main(String[] args) throws NullPointerException, IOException {
//Testing the setLastModified()
File e = new File("xanadu.txt").setLastModified(new Date().getTime());
}
}
I cut out the unimportant part. The question is why am I getting the error: incompatible type:
Code:
----jGRASP exec: javac -g Test.java
Test.java:66: error: incompatible types
File e = new File("xanadu.txt").setLastModified(new Date().getTime());
^
required: File
found: boolean
1 error
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
I copied this code from the tutorial after thinking that I typed it wrongly and somehow missed something.
Would you point me in the right direction please? Thanks!