Consider the following inheritance hierarchy diagram: Which of the following statements is correct?
Author: Anonymous
Which problem-solving technique examines partial solutions,…
Which problem-solving technique examines partial solutions, abandons unsuitable ones, and returns to consider other candidate solutions.
Consider the following code snippet: class MouseClickedListe…
Consider the following code snippet: class MouseClickedListener implements ActionListener { public void mouseClicked(MouseEvent event) { int x = event.getX(); int y = event.getY(); component.moveTo(x,y); } } What is wrong with this code?
Consider the following code snippet: Employee anEmployee = n…
Consider the following code snippet: Employee anEmployee = new Programmer(); anEmployee.increaseSalary(2500); If the Programmer class inherits from the Employee class, and only the Employee class has an implementation of the increaseSalary method, which statement is correct?
When using a combo box, the _______ displays the name of the…
When using a combo box, the _______ displays the name of the current selection.
Consider the following code snippet: public class Vehicle {…
Consider the following code snippet: public class Vehicle { . . . public void setVehicleClass(double numberAxles) { . . . } } public class Motorcycle extends Vehicle { . . . public void setModelName(String model) { . . . } public void setVehicleClass(double numberAxles) { . . . } } Which of the following statements is NOT correct?
Consider the following code snippet, assuming that descripti…
Consider the following code snippet, assuming that description is a String and totalPrice is a double: System.out.printf(“%-12s%8.2f”,description,totalPrice); Which of the following statements is correct?
Consider the following code snippet: LinkedList myLList = ne…
Consider the following code snippet: LinkedList myLList = new LinkedList(); myLList.add(“Mary”); myLList.add(“John”); myLList.add(“Sue”); ListIterator iterator = myLList.listIterator(); iterator.next(); iterator.next(); iterator.add(“Robert”); iterator.previous(); iterator.previous(); iterator.remove(); System.out.println(myLList); What will be printed when this code is executed?
The method below generates all nonempty substrings of a word…
The method below generates all nonempty substrings of a word passed as argument. Assuming that the string contains no duplicate characters, select the statement to complete the method so that it prints all nonempty substrings correctly. public static void printSubstrings(String word) { if (word.length() > 0) { for (int j = 1; j
Consider the following code snippet: public interface Measur…
Consider the following code snippet: public interface Measurable { double getMeasure(); ____________ double sum(Measurable[] objects) { // implementation to compute the sum of the Measurable objects } } Which of the following completes the interface declaration correctly?