Java_Static - アールメカブ

アールメカブ


Java_Static

Programming

Static クラスメソッド 2006 02 14

   例えば次のようにするとエラーになる
 public testClass{
    public static void main(String[] args) {
         show();
    }
 
    public void show(){
       System.out.println("test");
    }
}

これは show関数が static 方でないのに,オブジェクトを作成せずに関数を直接実行しようとしているからである。

 
Link: Programming(4977d)
Last-modified: 2007-10-07 (日) 14:43:50 (6038d)