用static可以来修饰方法或变量
先看一段程序
package cn.itcast.example;
class Test{
public static void main(String[]args)
{
// DeadLockThread d1=new DeadLockThread(true);
// DeadLockThread d2=new DeadLockThread(false);
// new Thread(d1,"Chinese").start();
// new Thread(d2,"American").start();
}
}
class fun{
int a;
static int b;
public void f1() {
}
public static void f2() {
}
}