🎴 Flashcard Mode

Java Programming Fundamentals

Card1 / 13
Mastered0
Review0
QuestionClick to flip

try{ File f = new File("a.txt"); }catch(Exception e){ }catch(IOException io){ } Is this code create new file name a.txt ?

AnswerClick to flip back
A
Compile error
💡 Explanation:

The code fails to compile because it lists catch(Exception e) before catch(IOException io). Since Exception is the parent class of IOException, the second block is unreachable, causing a compile error.

Change Mode