GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Consider the following class: public class Stock implements…

Consider the following class: public class Stock implements Comparable { private String name; private double price; // other methods go here public int compareTo(Object otherObject) { Stock otherStock = (Stock) otherObject; __________________________________; } } Which is the best statement to use to complete the compareTo() method?

Read Details

Consider the following code snippet: public class Motorcycle…

Consider the following code snippet: public class Motorcycle extends Vehicle { private String model; . . . public Motorcycle(int numberAxles, String modelName) { model = modelName; super(numberAxles); } } What does this code do?

Read Details

Given the following class code: public class RecurseSample {…

Given the following class code: public class RecurseSample { public static void main(String[] args) { System.out.println(recurse(3)); } public static int recurse(int n) { int total = 0; if (n == 0) { return 0; } else { total = 3 + recurse(n – 1); } return total; } } What values will be printed when this code is executed?

Read Details

Which nodes need to be updated when we insert a new node to…

Which nodes need to be updated when we insert a new node to become the fourth node from the beginning of a doubly-linked list?

Read Details

Given the following class code: public class RecurseSample {…

Given the following class code: public class RecurseSample { public static void main(String[] args) { System.out.println(recurse(3)); } public static int recurse(int n) { int total = 0; if (n == 0) { return 0; } else { total = 3 + recurse(n – 1); } return total; } } What values will be printed when this code is executed?

Read Details

If the current method in a program will not be able to handl…

If the current method in a program will not be able to handle an exception, what should be coded into the method?

Read Details

Consider the following code snippet. File inputFile = new F…

Consider the following code snippet. File inputFile = new File(“dataIn.txt”); Scanner in = new Scanner(inputFile); while (in.hasNext()) { String input = in.next(); } Which of the following statements about this code is correct?

Read Details

Consider the following code snippet. File inputFile = new F…

Consider the following code snippet. File inputFile = new File(“dataIn.txt”); Scanner in = new Scanner(inputFile); while (in.hasNext()) { String input = in.next(); } Which of the following statements about this code is correct?

Read Details

Consider the method below, which displays the characters fro…

Consider the method below, which displays the characters from a String in reverse order.  Each character appears on a separate line.  Select the statement that should be used to complete the method so that it performs a recursive method call correctly. public static void printReverse(String word) { if (word.length() > 0) { ___________________________ System.out.println(word.charAt(0)); } }

Read Details

Which of the following objects should be used for reading fr…

Which of the following objects should be used for reading from a text file?

Read Details

Posts pagination

Newer posts 1 … 76,345 76,346 76,347 76,348 76,349 … 81,626 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top