16. The method below is designed to print the smaller of two values received as
ID: 3604615 • Letter: 1
Question
16. The method below is designed to print the smaller of two values received as arguments. Select the correct expression to complete the method.
}
a) value1 < value2
b) value1.compareTo(value2) > 0
c) value1.compareTo(value2) == 0
d) value1.compareTo(value2) < 0
17. Which of the following is the correct syntax for creating a File object?
a) File inFile = File("input.txt")
b) File inFile = new File("input.txt")
c) File inFile = File.open("input.txt")
d) File inFile = new File.open("input.txt")
18. Insert the missing code in the following code fragment. This code is intended to open a file and handle the situation where the file cannot be found.
a) catch (IOException exception)
b) catch (new exception (IOException))
c) catch (IllegalArgumentException exception)
d) catch (IOException)
Explanation / Answer
16. a) value1 < value2
17. b) File inFile = new File("input.txt")
18. a) catch(IOException exception)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.