logo

Crowdly

Looking for test answers and solutions? Browse our comprehensive collection of verified answers for at moodle.lsu.edu.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Consider the following code snippet:

Employee anEmployee = new Programmer();

String emp = anEmployee.toString();

Assume that the Programmer class inherits from the Employee class, and neither class has an implementation of the toString method. Which of the following statements is correct? 

100%
0%
0%
0%
View this question

Consider the following code snippet:

Vehicle aVehicle = new Auto(4,"gasoline");

String s = aVehicle.toString();

Assume that the Auto class inherits from the Vehicle class, and neither class has an implementation of the toString() method. Which of the following statements is correct? 

100%
0%
0%
0%
View this question

Which of the following statements about abstract methods is true?

0%
0%
0%
0%
View this question

Consider the following code snippet:

Employee anEmployee = new Programmer(); 

anEmployee.increaseSalary(2500);

Assume that the Programmer class inherits from the Employee class, and both classes have an implementation of the increaseSalary method with the same set of parameters and the same return type. Which class's increaseSalary method is to be executed is determined by ____. 

0%
0%
100%
0%
View this question

Consider the following code snippet:

Vehicle aVehicle = new Auto(); 

aVehicle.moveForward(200);

Assume that the Auto class inherits from the Vehicle class, and both classes have an implementation of the moveForward method with the same set of parameters and the same return type. Which class's moveForward method is to be executed is determined by ____. 

100%
0%
0%
0%
View this question

Consider the following code snippet:

Vehicle aVehicle = new Auto(); 

aVehicle.moveForward(200);

Assume that the Auto class inherits from the Vehicle class, and both classes have an implementation of the moveForward method with the same set of parameters and the same return type. The process for determining which class's moveForward method to execute is called ____. 

0%
0%
0%
100%
View this question

Consider the following code snippet:

Employee anEmployee = new Programmer(); 

anEmployee.increaseSalary(2500);

If the Programmer class inherits from the Employee class, and both classes have an implementation of the increaseSalary method with the same set of parameters and the same return type, which statement is correct? 

100%
0%
0%
0%
View this question

Consider the following code snippet:

Vehicle aVehicle = new Auto(); 

aVehicle.moveForward(200);

If the Auto class inherits from the Vehicle class, and both classes have an implementation of the moveForward method with the same set of parameters and the same return type, which statement is correct? 

100%
0%
0%
0%
View this question

Consider the following class hierarchy:

public class Vehicle

{

   private String type;

   public Vehicle(String type)

   {

      this.type = type;

   }

   public String getType()

   {

      return type;

   }

}

public class LandVehicle extends Vehicle

{

   public LandVehicle(String type)

   {

      . . .

   }

}

public class Auto extends LandVehicle

{

   public Auto(String type)

   {

      . . .

   }

}

Which of the following code fragments is NOT valid in Java?

0%
0%
0%
100%
View this question

Consider the following code snippet:

public class Motorcycle extends Vehicle

{

   private String model;

   . . . 

   public Motorcycle(int numberAxles, String modelName)

   {

      super(numberAxles); 

      model = modelName;

   }

}

What does this code do?

100%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.lsu.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!