package com.example.domain;

public class TestThread {

	public static void main(String[] args) {
		// get currently running thread - main
		Thread current = Thread.currentThread();
		System.out.println(current + " starting...");
		
		for (int k = 0; k < 3; k++) {
			// create object MyThread
			new MyThread();
		}
		
		// access static variable using class
		System.out.println("class: " + MyThread.counter);
		
		// access static variable using object
		MyThread t = new MyThread();
		System.out.println("object: " + t.counter);
		
		System.out.println(current + " exiting...");
	}

}
