关于java静态类的调用

 1 public class TestStatic {
2 public static void main(String[] args) {
3 StaticT.tes();
4 StaticT s=new StaticT();
5 s.tes();
6 }
7
8 }
9 class StaticT {
10 static void tes() {
11 System.out.println("fssf");
12 }
13 }

 我一开始把TestStatic类中的main方法中没有写new StaticT()就用该变量访问StaticT中的静态方法

害的我还以为静态方法不能用变量访问了

posted @ 2012-02-19 23:55  徐徐而来  阅读(521)  评论(0编辑  收藏  举报