Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main
- {
- public static void main (String[]args)
- {
- for (int i = 1; i <= 10; i++)
- {
- Cat cat1 = new Cat ();
- }
- System.out.println (Cat.catCount);
- }
- public static class Cat
- {
- public static int catCount;
- public Cat ()
- {
- catCount++;
- }
- }
- }
Add Comment
Please, Sign In to add comment