Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 35 1 pts Skip to question text. Consider the following code snippet: pu

ID: 640143 • Letter: Q

Question

Question 35 1 pts Skip to question text.

Consider the following code snippet:
public class Demo
{
public static void main(String[] args)
{
Point[] p = new Point[4];

p[0] = new Colored3DPoint(4, 4, 4, Color.BLACK);
p[1] = new ThreeDimensionalPoint(2, 2, 2);
p[2] = new ColoredPoint(3, 3, Color.RED);
p[3] = new Point(4, 4);

for (int i = 0; i < p.length; i++)
{
String s = p[i].toString();
System.out.println("p[" + i + "] : " + s);
}
return;
}
}

Flag this Question

Question 36 1 pts <p>Which of the following is a good use for an anonymous class?</p>

Which of the following is a good use for an anonymous class?

Flag this Question

Question 37 1 pts <p>To respond to a button event, a listener must supply instructions for the __________ method of the ActionListener interface</p>

To respond to a button event, a listener must supply instructions for the __________ method of the ActionListener interface

Flag this Question

Question 38 1 pts <p>Which of the following statements about an inner class is true?</p>

Which of the following statements about an inner class is true?

Flag this Question

Question 39 1 pts <p>To build a user interface that contains graphical components, the components _____________.</p>

To build a user interface that contains graphical components, the components _____________.

Flag this Question

Question 40 1 pts <p>How do abstract classes and interfaces differ?</p>

How do abstract classes and interfaces differ?

overloading

Explanation / Answer

1)polymorphism
2)Use an anonymous class for event handlers when the program will only need one object of the class
3)actionPerformed
4)An inner class can access variables from the enclosing scope only if they are passed as constructor or method parameters.
5)must be added to a panel that is contained within a frame
6)You cannot instantiate abstract class; you can an interface.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote