Advertisement
KechevD

Cars

Jan 28th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class CatManipulating {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         Cat someCat = new Cat();
  6.  
  7.         Cat cat1 = new Cat("Ivan","grey");
  8.  
  9.         Cat cat2 = new Cat("Niki","white");
  10.  
  11.  
  12.  
  13.         System.out.printf("Cat %s is %s.%n", someCat.name, someCat.color);
  14.  
  15.         System.out.printf("Cat %s is %s.%n", cat1.name, cat1.color);
  16.  
  17.         System.out.printf("Cat %s is %s.%n", cat2.name, cat2.color);
  18.  
  19.  
  20.  
  21.         cat1.sayMeow();
  22.  
  23.         cat2.notHungryAnymore();
  24.  
  25.  
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement