初級 › Main method not found in class の原因と直し方 › パターン2
Main method not found in class の原因と直し方
コンパイルは通るのに実行できない典型。
1 public class Main { 2 public ____________ void main(String[] args) { ^ 3 System.out.println("Hello"); 4 } 5 }
Error: Main method is not static in class Mainexited with code 1
空欄を埋めてビルドを通す
mainはインスタンスを作る前に呼ばれるので、staticでなければなりません。
次の問題