Multiple choice technology programming languages

package io; import java.io.*; public class TestFile1 { public static void main(String[] args) { //No file exists by the name test_file.txt File file = new File("test_file.txt"); System.out.print(" Fle Name = "+file.getName()); System.out.print(" File Status = "+file.exists()); } }

  1. Fle Name = test_file.txt File Status = false

  2. Compiler Error

  3. Null Pointer Exception

  4. Fle Name = test_file.txt File Status = true

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The File constructor in Java does not create a file on the disk or check for its existence; it merely creates an in-memory representation of the path. Thus, getName() returns the file name string "test_file.txt", and exists() returns false.