Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dog {
- int age;
- public Dog (int dogsAge) {
- age = dogsAge;
- }
- public void bark(){
- System.out.println("Woof!");
- }
- public void run(int feet) {
- System.out.println("Your dog ran "+ feet +" feet!");
- }
- public int getAge(){
- return age;
- }
- public static void main(String[] args) {
- Dog spike = new Dog(4);
- spike.bark();
- spike.run(40);
- int spikeAge = spike.getAge();
- System.out.println(spikeAge);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement