1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Object-Oriented Programming in Java

Connected

Exercise

Overriding methods

Java allows us to provide custom implementations for inherited methods. To demonstrate this, you will use a method created in a base class and provide custom implementations of the method in the sub-class. You will achieve this by harnessing a method created in the Car class and using the override feature of Java OOP.

Instructions

100 XP
  • Inside the Tesla class, override and implement the steer public void method.
  • Inside the steer method, print out the message "tesla steer".
  • Call the steer method using the myTesla object instance.