Created
November 14, 2018 19:05
-
-
Save mattymess/74984e4e5cabc7afb303c33a4b59ab5a to your computer and use it in GitHub Desktop.
Dog
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
class Kennel { | |
public static void main(String[] args) { | |
int numOfDogs = 3; | |
String kennelName = "The Kennel"; | |
double costPerNight = 10.00; | |
// <type of class> <variableName> = <variableValue> | |
Dog someDog = new Dog("Riley"); | |
Dog dog2 = new Dog("Cali"); | |
System.out.println(someDog.name); | |
System.out.println(dog2.name); | |
// write a loop that loops over numOfDogs and prints the name of each dog | |
// expected output: | |
// Riley | |
// Cali | |
// Riley | |
// Cali | |
// Riley | |
// Cali | |
} | |
} | |
class Dog { | |
public String name; | |
public Dog(String dogName) { | |
this.name = dogName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment