Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AnimalTest {
- public static void main (String args[]) {
- Dog d = new Dog ("poodle",4);
- Cat c = new Cat("cat",4);
- System.out.println("The name of dog is "+d.getName()+".");
- System.out.println("The dog has "+d.getLegs()+" legs.");
- System.out.println("The dog makes '"+d.noise()+"' sound.");
- System.out.println("The name of cat is "+c.getName()+".");
- System.out.println("The cat has "+c.getLegs()+" legs.");
- System.out.println("The cat makes '"+c.noise()+"' sound.");
- }
- }
Add Comment
Please, Sign In to add comment