Question: The red circle Question only. Please explain the right anwser. 1. When you write an action listener class for a JButton component, it mus t:
1. When you write an action listener class for a JButton component, it mus t: A) have a method named buttonClicked B) implement the ActionLIstener interface C) have a method named actionPerformed which must take an argument type D) both B and C 2. Given the following statement, which statement will write "Calvin" to the file DiskFile.txt? PrintWriter diskOut- new PrintWriter("DiskFile.txt") A) System.out.printin(diskOut, "Calvin") B) DiskFile.printin("Calvin") rintWriter.printin("Calvin"); diskOut.printin("Calvin"); 3. In a try/catch construct, after the catch statement is executed: A) the program returns to the statement following the statement in which the exception occurred B) the program terminates C) the program resumes at the statement that immediately follows the try/catch construct D) the program resumes at the first statement of the try statement 4. The compareTo method of the Comparable interface Xreturns true when the calling object is "less than" the object passed as the parameter B) returns a negative integer when the calling object is "less than" the object passed as the parameter C) returns zero when the calling object fails to equal the object passed as parameter D) None of the above 5. An array of 4 elements is being sorted in ascending order using the insertion sort algorithm. Hox y comparisons will insertion sort perform if the array was originally sorted in descending order n A) 2 comparisons comparisons comparisons D) None of the above
Step by Step Solution
There are 3 Steps involved in it
Lets go through each of the questions one by one Question 1 When you write an action listener class for a JButton component it must A have a method named buttonClicked B implement the ActionListener i... View full answer
Get step-by-step solutions from verified subject matter experts
