Consider the classes shown below: public class Parent { publ…

Consider the classes shown below: public class Parent { public void doSomething(){/* Implementation not shown */} } public class Child extends Parent { public void doAnotherThing(){/* Implementation not shown */} } Which lines in the following code will compile without error? Child kid = new Child(); kid.doSomething(); // line 1 kid.doAnotherThing(); // line 2

Consider the following code snippet: public class Vehicle {…

Consider the following code snippet: public class Vehicle { . . . public void setVehicleClass(double numberAxles) { . . . } } public class Auto extends Vehicle { . . . public void setVehicleClass(int numberAxles) { . . . } } Which of the following statements is correct?

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; } public int getValue() { return value; } } What is the output of the following lines of code? Child kid1 = new Child(-14); Child kid2 = new Child(21); System.out.println(kid1.getValue() + ” ” + kid2.getValue());

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 kid2 = new Child(21); System.out.println(kid.getValue() + ” ” + kid2.getValue());

Complete the code for the calcPower recursive method shown b…

Complete the code for the calcPower recursive method shown below, which is intended to raise the base number passed into the method to the exponent power passed into the method: public static int calcPower(int baseNum, int exponent) { int answer = 0; if (exponent == 0) { answer = 1; } else { _______________________________________ } return answer; }