Question: Problem 4 Class CastException. Use the RollerBot class from Day 3 practice 2. Update the Exceptionemg class. Create a method class called moveByWalking that passes

 Problem 4 Class CastException. Use the RollerBot class from Day 3

Problem 4 Class CastException. Use the RollerBot class from Day 3 practice 2. Update the Exceptionemg class. Create a method class called moveByWalking that passes in a Robot object and a distance (double). The method will return nothing. The method will cast the Robot as a WalkerBot and then call the move method, passing in the distance. Update the main method. Comment out the previous call to updateFlightPrice and its surrounding try/catch. Create a new RollerBot. Pass that object into the moveByWalking method with a distance of Surround the call by a try/catch for ClassCastException. Have the catch print the stacktrace. Class outline: . ExceptionDemo main(String[]); void updateArray(int[], int, int) : void getDouble: double updateFlightPrice/Flight double): void moveByWalking (Robot, double): void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!