对应的就是:静态变量/类变量;静态方法;静态代码

     eg: public class Student{

                public static int a = 0;

                public static int getValue(){

                       return a;

                }

           }

       静态引入包名: 

1 import static java.util.Math;//在包名前多了一个static关键字
2 public class Test{
3       public static void main(String[] args){
4            //这个sin是Math类中的静态方法,
5           //以前常用Math.sin()来调用,静态引入后则无需类名
6             double a = sin(45);
7       }
8 }
View Code

相关文章: