Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package samkough.main;
- public class Dog
- {
- public static void main(String args[])
- {
- DogTestDrive one = new DogTestDrive();
- one.size = 70;
- DogTestDrive two = new DogTestDrive();
- two.size = 8;
- DogTestDrive three = new DogTestDrive();
- three.size = 35;
- one.bark();
- two.bark();
- three.bark();
- }
- }
- ------------------------------------------------------------------------------------------------------------------
- package samkough.main;
- public class DogTestDrive
- {
- int size;
- String name;
- void bark()
- {
- if (size > 60)
- {
- System.out.println("Wooof! Wooof!");
- }
- else if (size > 14)
- {
- System.out.println("Ruff! Ruff!");
- }
- else
- {
- System.out.println("Yip! Yip!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment