GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Consider the following code snippet:   public class MyMouseL…

Consider the following code snippet:   public class MyMouseListener { public void mousePressed(MouseEvent event) { double x; double y; _______ System.out.println(“x: ” + x + “, y: ” + y); } } Which of the following statements should be in the indicated position to print out where the mouse was pressed?

Read Details

To use an interface, a class header should include which of…

To use an interface, a class header should include which of the following?

Read Details

Assume you are using a doubly-linked list data structure wit…

Assume you are using a doubly-linked list data structure with many nodes. What is the minimum number of node references that are required to be modified to remove a node from the middle of the list? Consider the neighboring nodes.

Read Details

Which of the following statements about character encodings…

Which of the following statements about character encodings is NOT true?

Read Details

Assume inputFile is a Scanner object used to read data from…

Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.  Some lines contain an alphabetic string, while others contain a single integer value.  Select an expression to complete the following code segment, which counts the number of integer values in the input file. int count = 0; while (inputFile.hasNextLine()) { if (________________________________) { count++; } inputFile.nextLine(); } System.out.println(count);

Read Details

Consider the following class hierarchy: public class Vehicle…

Consider the following class hierarchy: public class Vehicle { private String type; public Vehicle(String type) { this.type = type; } public String displayInfo() { return type; } } public class LandVehicle extends Vehicle { public LandVehicle(String type) { super(type); } } public class Auto extends LandVehicle { public Auto(String type) { super(type); } } You have written a program to use these classes, as shown in the following code snippet: public class VehicleTester { public static void main(String[] args) { Auto myAuto = new Auto(“sedan”); System.out.println(“MyAuto type = ” + ______); } } Complete the code in this program snippet to correctly display the auto’s type.

Read Details

Select an appropriate expression to complete the following m…

Select an appropriate expression to complete the following method, which is designed to return the number of elements in the parameter array numbers.  If a value appears more than once, it should be counted exactly once. public static int countElementsOnce(int[] numbers) { Set values = new HashSet(); for (int num: numbers) { values.add(num); } ______________________ }

Read Details

Assume inputFile is a Scanner object used to read data from…

Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.  Some lines contain an alphabetic string, while others contain a single integer value.  Select an expression to complete the following code segment, which counts the number of integer values in the input file. int count = 0; while (inputFile.hasNextLine()) { if (________________________________) { count++; } inputFile.nextLine(); } System.out.println(count);

Read Details

Assume that names is an array of String objects that has bee…

Assume that names is an array of String objects that has been initialized with a large number of elements.  Select the statement that would sort the elements in names in ascending alphabetic order.

Read Details

What is known for certain from this correct code excerpt? A…

What is known for certain from this correct code excerpt? ActionListener openListener = new FileOpenListener(); JMenuItem fileOpen = new JMenuItem(“Open File”); fileOpen.addActionListener(openListener);

Read Details

Posts pagination

Newer posts 1 … 75,017 75,018 75,019 75,020 75,021 … 80,290 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top