Advertisement
ridjis

java

Jun 17th, 2014
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. Classes
  2.  
  3. These are what you will be coding. Think of classes as the blueprints for the object. They describe what the object contains and what it can do.
  4.  
  5. Instance Variables
  6.  
  7. These are the attributes of the object. For example, a Student object would have instance variables like name, GPA, and classification.
  8.  
  9. Methods
  10.  
  11. These are the actions that an object can make. To use the Student example, these could be things like getting the GPA or taking a class.
  12.  
  13. Packages (1)
  14.  
  15. Packages provide an organizational tool for Java projects by grouping similar classes together. A common naming convention is to use your domain backwards. As you can see, this project uses the Instructable domain. This helps to eliminate any issues when integrating Java programs. You may not run into this, but it is a good habit to get into.
  16.  
  17. The two packages in this project are game and main. The game package contains the more backend information for running the game. The main  package includes the class that interacts with the user.
  18.  
  19. Classes (2)
  20.  
  21. There are three classes in this project--Board, Player, an Runner. When deciding which classes need to be made for a project, think about the elements of what you're making. In this case, Tic Tac Toe only had two notable elements--a player to play the game and a board to play the game on. More complex programs will require more classes.
  22.  
  23. Board
  24. This represents the Tic Tac Toe board. This class handles keeping track the of the state of the board and if the board is a winning board.
  25.  
  26. Player
  27. This represents a player in Tic Tac Toe. It's a fairly simple class. It stores the player's name and it's playing symbol It also handles marking the board.
  28.  
  29. Runner
  30. This class is what runs the program. We'll go into an overview in the next step.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement