1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Introduction to Object-Oriented Programming in Java

Connected

अभ्यास

Implementing interface on Tesla class

To make the Tesla class have the self-driving feature, you will use the ElectricCar interface to enable this feature. In the Tesla class, you will harness the interface and implement the self-driving method as a requirement.

NOTE: Interface non-void methods must be implemented in the class implementing the interface.

निर्देश

100 XP
  • Implement the ElectricCar interface using the implements keyword on the Tesla class.
  • Implement the void activateSelfDriving method inside the Tesla as a public method, and make it print out "self driving on" when called.
  • Call the activateSelfDriving method on the myTesla object instance.