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(); } } } }

31st May 2022, 6:28 AM
Nazik Aljilee
2 Respostas
+ 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) { } } }
31st May 2022, 7:53 AM
Sinoeun Sarith
Sinoeun Sarith - avatar
+ 1
try{ // code } catch(exception) { // code } not try { catch() {} }
31st May 2022, 7:55 AM
Sinoeun Sarith
Sinoeun Sarith - avatar