In Java, which of the following mechanisms describe the copying of an object reference into a parameter variable?
Blog
Given the following class definition, which of the following…
Given the following class definition, which of the following are considered part of the class’s public interface? public class CashRegister { public static final double DIME_VALUE = 0.1; private static int objectCounter; public void updateDimes(int dimes) {. . .} private boolean updateCounter(int counter) {. . .} }
Consider the following code snippet: public class Motorcycle…
Consider the following code snippet: public class Motorcycle extends Vehicle { . . . public Motorcycle(int numberAxles) { super(numberAxles); //line #1 } } If the line marked “//line #1” was missing, which of these statements would be correct?
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) { _________; } } Complete the code in the Auto class constructor to store the type data.
Which of the following can potentially be changed by a Java…
Which of the following can potentially be changed by a Java method?
Judging by the name of the method, which of the following me…
Judging by the name of the method, which of the following methods would most likely be a mutator method?
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?
Consider the classes shown below: public class Parent { priv…
Consider the classes shown below: public class Parent { private int value = 100; public int getValue() { return value; } } public class Child extends Parent { private int value; public Child(int number) { value = number; } } What is the output of the following lines of code? Child kid = new Child(-14); Parent adult = new Parent(); System.out.println(kid.getValue() + ” ” + adult.getValue());
Mutator methods exhibit which of the following types of side…
Mutator methods exhibit which of the following types of side effect?
Which of the following describes an immutable class?
Which of the following describes an immutable class?