October 2014
Beginner to intermediate
285 pages
6h 24m
English
Suppose you were to write a game like Minecraft from scratch. You’d want to have a bunch of players in the game. Each one would have its own name, inventory, health points, and so on, but the structure of each player would be the same.
That is, every player object would have the same collection of variables (name, health, location, and so on) and the same functions that you’d want to run (set this player’s health, teleport the player to a new location, that sort of thing). That’s where objects come in. You’d create an object in Java to represent each player in the system. You’d write code to do things to a player, and that code would work no matter which specific player you were using at the time. ...
Read now
Unlock full access