Guest User

1

a guest
Mar 15th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. public class Main
  2. {
  3. public static void main (String[]args)
  4. {
  5. for (int i = 1; i <= 10; i++)
  6. {
  7. Cat cat1 = new Cat ();
  8. }
  9. System.out.println (Cat.catCount);
  10. }
  11.  
  12. public static class Cat
  13. {
  14.  
  15. public static int catCount;
  16.  
  17. public Cat ()
  18. {
  19. catCount++;
  20. }
  21.  
  22. }
  23. }
Add Comment
Please, Sign In to add comment