Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package prj10072021;
- public class Player {
- private String name;
- private int pos;
- public Player(String name) {
- this.name = name;
- this.pos = 1;
- System.out.println("New player was created: " + this.name);
- }
- public void move(int n) {
- this.pos = this.pos + n;
- System.out.println("Player " + this.name + " moved to " + this.pos);
- }
- public int getPos() {
- return this.pos;
- }
- public String getName() {
- return name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement