tdudzik

Untitled

May 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. package io.github.tdudzik.testproject;
  2.  
  3. class A {
  4.  
  5.     A() {
  6.         System.out.println("A created.");
  7.     }
  8. }
  9.  
  10. class B {
  11.  
  12.     B() {
  13.         System.out.println("B created.");
  14.     }
  15. }
  16.  
  17. class C {
  18.  
  19.     private final static A a = new A();
  20.  
  21.     C() {
  22.         new B();
  23.     }
  24. }
  25.  
  26. public class TestProjectApp {
  27.  
  28.     public static void main(String[] args) {
  29.         for (int i = 0; i < 10; i++) {
  30.             new C();
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment