Last active
August 29, 2015 14:16
-
-
Save DCRichards/d0eb3aaf103013e6626a to your computer and use it in GitHub Desktop.
A simple dog class
This file contains hidden or 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 Dog { | |
String name; | |
public Dog(String name) { | |
this.name = name; | |
System.out.println("Hello, I'm " + name); | |
} | |
public void bark() { | |
System.out.println(name + " says WOOF!"); | |
} | |
public static void main(String[] args) { | |
Dog myDog = new Dog("Barney"); | |
myDog.bark(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment