Thread与Runable都可以实现资源共享,
只要创建一个实现类,传递到多个线程中,就可以完成;
Thread:
Demo01Thread t = new Demo01Thread();
new Thread(t,"one").start();
new Thread(t,"two").start();
Runable:
RunableImpl r = new RunableImpl();
Thread one = new Thread(r);
Thread two = new Thread(r);
Thread three = new Thread(r);
one.start();
two.start();
three.start();