Advertisement
Guest User

Non-Enum Example

a guest
Oct 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. class Hand {
  2.     int currentMove;
  3.     // 0 rock, 1 scissors, 2 paper
  4.    
  5.     public void setMove(int currentMove) {
  6.         this.currentMove = currentMove;
  7.     }
  8.    
  9.     public void printCurrentMove() {
  10.         System.out.println(currentMove);
  11.     }
  12. }
  13.  
  14. public class Program {
  15.     public static void main(String args[]) {
  16.         Hand alex = new Hand();
  17.         Hand jared = new Hand();
  18.        
  19.         alex.setMove(0);
  20.         alex.printCurrentMove();
  21.        
  22.         jared.setMove(2);
  23.         jared.printCurrentMove();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement