Hello!
Consider the following code:
public class TestUppgift1 { public static void main(String [] arg) { Scanner sc = new Scanner(new InputStreamReader(System.in)); String katalog = ""; File fil0 = new File("C:\\Hej\\a"); File fil02 = new File("C:\\Hej\\b"); File fil = new File(fil0, "hejsan.txt"); File fil2 = new File(fil02, "dal.txt"); if(fil.exists()) { System.out.println("Du har fattart!"); if(fil2.exists()) { if(fil.renameTo(fil2)==true) { System.out.println(fil.getName()); } } } } }
Why can't I rename fil?
Hank