concept move in category java

appears as: move, move, moves, moves
OCA Java SE 8 Programmer I Certification Guide

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.

Option (a) is correct. Because the interface Movable defines the method move, you can pass a variable of its type to the method move.

Option (b) is correct. Because the class Person implements the interface Movable and defines the method move, you can pass a variable of its type to the method walk. With this version of the method walk, you can pass it an object of the class Person or any of its subclasses.

Option (c) is correct. Because the class Vehicle implements the interface Movable and defines the method move, you can pass a variable of its type to the method walk. With this version of method walk, you can pass it an object of the class Vehicle or any of its subclasses.

JavaFX in Action

This is an excerpt from Manning's book JavaFX in Action.

  • Because Motor appears first on the extends list, it’s first to be considered. Our Robot class implements neither a distance variable nor a move() function, so the default implementations are inherited, including their value/body. (If you can’t be bothered to provide your own, you get one for free!)
  • To aid the player we’ll add a radar, similarly retro fashioned, giving an idea of where the player is in relation to the boundaries of the maze. We’ll also add a compass, spinning to show which way the view is facing. A game needs a score, so we’ll track the number of moves the player has made, the objective being to solve the maze in as few moves as possible.

    Figure 10.8. The scoreboard sits at the bottom of the display, showing the moves used and a “SUCCESS!” message once the end of the maze is reached