This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
i am getting two different result from almost same programs on winnt. program 1. String file = "C:\abc.txt"; File name = new File(file); if(name.isFile()) System.out.print("it is a file") else System.out.print("file does not exists") its out put is "file does not exists"
program 2. i use same code on JSP and get file path through fileDialog box and it outputs "file exists" why two different outputs ? ------------------
dear khasif, try hard coding the full path in your second code i.e via JSP,I think it should give u file not exists if if r not having any file by that name.Remember a file class object doest not creates a file but only captures the path leading to that file.If u want to create a file u need to use fileoutputstream or random acess,which internally may be happening when u r giving path by file dialogbox.