glee20

Animal Test

Oct 4th, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public class AnimalTest  {
  2.     public static void main (String args[]) {
  3.         Dog d = new Dog ("poodle",4);
  4.         Cat c = new Cat("cat",4);
  5.         System.out.println("The name of dog is "+d.getName()+".");
  6.         System.out.println("The dog has "+d.getLegs()+" legs.");
  7.         System.out.println("The dog makes '"+d.noise()+"' sound.");
  8.         System.out.println("The name of cat is "+c.getName()+".");
  9.         System.out.println("The cat has "+c.getLegs()+" legs.");
  10.         System.out.println("The cat makes '"+c.noise()+"' sound.");
  11.     }
  12. }
Add Comment
Please, Sign In to add comment