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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started