0
Guys can i know what is wrong here?
package java.io; import java .io.File; import java .io.IOExeption ; public class CreatFile { public static void main(String[] args) { try { File o=new File("zkzk.txt"); if(o.CreatNewFile()){ System .out .println ("File Created:"+o.getName());} else{ System.out.println ("File already exsist"); } catch (IoExeption e){ System .out .println ("an error ocoured"); e.PrintStackTrace(); } } } }
2 Answers
+ 1
import java.io.File;
public class CreatFile
{
public static void main(String[] args)
{
try
{
File o = new File("");
if(o.exists())
{
System .out .println ("File Created:"+o.getName());}
else
{
System.out.println ("File already exsist");
}
}
catch(Exception e)
{
}
}
}
+ 1
try{
// code
}
catch(exception) {
// code
}
not
try
{
catch()
{}
}