Question: 1 Which method can be used to create an input object for file temp.txt? new Scanner(temp.txt) new Scanner(temp.txt) new Scanner(new File(temp.txt)) new Scanner(File(temp.txt)) 2,The methods
1
Which method can be used to create an input object for file temp.txt?
new Scanner("temp.txt")
new Scanner(temp.txt)
new Scanner(new File("temp.txt"))
new Scanner(File("temp.txt"))
2,The methods getMessage(), printStackTrace(), and toString() are available in ________ class.
RuntimeException
Exception
Throwable
IOException 3,
Which of the following statements are true?
If a file (e.g., c:\temp.txt) does not exist, new File("c:\\temp.txt") returns null.
If a directory (e.g., c:\liang) does not exist, new File("c:\liang") returns null.
If a file (e.g., c:\temp.txt) does not exist, new File("c:\\temp.txt") creates a new file named c:\temp.txt.
If a directory (e.g., c:\liang) does not exist, new File("c:\liang") creates a new directory named c:\liang.
None of these. 4,
A method cannot throw Exception or a subclass of Exception if it is not claimed in the method declaration.
true
false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
