Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← A Second Interface - Intro to Java Programming

Get Embed Code
6 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  1. Now our suburban scene was quaint, but it was rather static. Let's add a second
  2. interface to add some motion. The moveable interface has a method move, and we
  3. give the number of seconds for the simulated motion. Now, cars are moveable,
  4. our car class implements two interfaces, drawable, and movable. Lets see how
  5. that start. The car class now needs to implement the methods of both the
  6. drawable and the movable interface. Here is the draw method that we've always
  7. had, here is the move method we'll arbitrarily say that these cars moves at 10
  8. pixel per second. And each of the components of the car is moved by that
  9. amount. What's it look like? When you run the program, you can see this car
  10. here moving. Later, we'll move the other cars as well, but for now please go
  11. ahead and move Fido as well.