Question 1
Not yet answered
Marked out of 1.00
Flag question
Question text
Consider the following Java program. Which line implements an interface method?
import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener
{
MouseWhisperer() {
super("COME CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }
public void mousePressed(MouseEvent e) { setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU");
}
public void mouseExited(MouseEvent e) { setTitle("COME
CLOSER"); }
public static void main(String[] args) { new
MouseWhisperer(); }
}
Select one:
a. addMouseListener(this);
b. public class MouseWhisperer extends JFrame implements MouseListener {
c. public static void main(String[] args) { new MouseWhisperer(); }
d. public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }
e. setVisible(true);
Clear my choice
Question 2
Not yet answered
Marked out of 1.00
This study source was downloaded by 100000848649392 from CourseHero.com on 08-15-2022 04:41:45 GMT -05:00
https://www.coursehero.com/file/64926389/CS-1102-Final-exam-part-1docx/
, Flag question
Question text
In a for loop, how many times does the continuation condition run?
Select one:
a. Zero or more times, at the beginning of each iteration.
b. Zero or more times, at the end of each iteration.
c. At least once, at the beginning of each iteration.
d. At least once, at the end of each iteration.
e. Exactly once.
Clear my choice
Question 3
Not yet answered
Marked out of 1.00
Flag question
Question text
What is the output of the following Java program?
interface Food {
public void printFlavor();
}
class Pepper implements Food {
public void printFlavor() { System.out.println("spicy"); }
}
public class Lunch {
public static void main(String[] args) {
Food pepper = new Pepper();
pepper.printFlavor();
}
}
Select one:
a. bland
This study source was downloaded by 100000848649392 from CourseHero.com on 08-15-2022 04:41:45 GMT -05:00
https://www.coursehero.com/file/64926389/CS-1102-Final-exam-part-1docx/