Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NumberSeven {
- public NumberSeven(int initialPosition) {
- this.initialPosition = initialPosition;
- }
- public static void main(String[] args) {
- NumberSeven seven = new NumberSeven(1);
- seven.toString();
- }
- //fields
- public int initialPosition;
- public int startingPoint = 1;
- //constructor
- public void turn() {
- if (startingPoint == 1) {
- startingPoint = -1;
- }else {
- startingPoint = 1;
- }
- }
- public void move(int move) {
- initialPosition += move;
- }
- //getter
- public int getPosition() {
- return initialPosition;
- }
- public String toString() {
- return initialPosition + "";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement