package cn.oracle1;
public class Demo03 {
private int a = 1;public void calc(int times) {
a++; System.err.println(times + "," + Thread.currentThread().getName() + " a is:" + a);// 2 a--; }Thread t = new Thread() {
public void run() { for (int i = 0; i < 10; i++) { calc(i); } }; };Thread t2 = new Thread() {
public void run() { for (int i = 0; i < 10; i++) { calc(i); } }; };public static void main(String[] args) {
new Demo03(); }public Demo03() {
t.start(); t2.start(); }}