Created
December 11, 2015 00:27
-
-
Save franksands/d81c190ad845196894ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LivingThing { | |
public String name; | |
private int health; | |
//class other code | |
} | |
hero = LivingThing("Elsa", 50, 80, "Axe"); | |
// ...some more code... | |
if (someCondition) { | |
hero.health -= 50 //Compiler error, you cannot access health outside the class | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment