📚 Practice Mode

Java Programming Fundamentals

Learn at your own pace with hints and detailed explanations

1 / 13
Multiple Choice
  1. Assume that in the current directory test.txt file is already exist. What will happen when you execute the following code? import java.io.*; class Test { public static void main(String args[]) { try { File file = new File("test.txt"); file.createNewFile(); } catch (IOException ex) { ex.printStackTrace(); } } }
  1. text.txt will be created and overwrite the old file
  2. file will not be created
  3. exception will be thrown
  4. none of the above