This program should delete cookedBooks.txt, but it doesnt. I created cookedBooks.txt in a folder. Can somebody push me in the right directions.
Code:
import java.io.File;
import static java.lang.System.out;
import java.util.Scanner;
class DeleteEvidence {
public static void main(String[] args) {
File evidence = new File("cookedBooks.txt");
Scanner keyboard = new Scanner(System.in);
char reply;
do {
System.out.println("Delete Evidence? (Y/N) ");
reply =
keyboard.findWithinHorizon(".",0).charAt(0);
} while (reply != 'y' && reply != 'n');
if (reply == 'y') {
System.out.println("here we go");
evidence.delete();
System.out.println("Has been deleted");
}else{
System.out.println("Asking");
}
}
}