also ich versuche konsolen eingabe mir der scanner klasse abzufangen und diese wirft ja eine FileNotFoundException d.h. ich brauche einen try catch block ...
aber der compiler hat ein problem mit der FileNotFoundException
fehler:
wenn ich einfach nur Exception im catch block abfange klappts wunderbar o0
Code:
try {
Scanner sc = new Scanner ( System.in );
System.out.print ("\nSource File: ");
srcfile = sc.nextLine();
System.out.print ("\nDestination File: ");
destfile = sc.nextLine();
System.out.print ("\nEncryption Key: ");
key = sc.nextInt();
}
catch ( FileNotFoundException e ) {
System.err.println ("Error: " + e.getMessage());}
}
fehler:
Code:
Main.java:38: exception java.io.FileNotFoundException is never thrown in body of corresponding try state
ment
catch ( FileNotFoundException e ) {
^
1 error
wenn ich einfach nur Exception im catch block abfange klappts wunderbar o0