English subtitles

← Instanceof Test and Cast - Intro to Java Programming

Get Embed Code
6 Languages

Showing Revision 5 created 09/10/2017 by Dejan Trajkovic.

  1. Our task was to go through all of the elements and the list of the drawables,
  2. to check which ones are movable. That's done with the instance of operator. Now
  3. then we wanted to move them, but of course, we have convert them from drawables
  4. to moveables, that's done with this cast. Take the drawable, cast to moveable,
  5. save it in a moveable variable, and then we can use that variable to exercise
  6. the move method. When we run the program, we see the cars move, we see the dogs
  7. move, which really is a moving experience. Now, I'll turn it over to Sara,
  8. who will talk to you more about interfaces, the instance of operator and
  9. casting.