-1
類
沒有發現當我運行我的代碼,我收到此錯誤信息:錯誤::主要方法
Error: Main method not found in class "Class name", please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
我的代碼:
public static void main(String[] args){
public void printPhoto(int width,int height, boolean inColor){
System.out.println("Width = " + width + " cm");
System.out.println("Height = " + height + " cm");
if(inColor){
System.out.println("Print is Full color.");
} else {
System.out.println("Print is black and white.");
}
printPhoto(10,20,false);
}
}
是不是錯誤不夠清楚? BTW。你需要向我們展示主要方法的代碼,如果確實存在的話。確保它是'public static void main(String args [])' –
然後在你的類中創建一個'public static void main(String [] args)'? – QBrute
世界的Smaile沒有以正確的語境提出問題。它是Jetbrains IDE IDE的一個問題。我也有同樣的問題。我是一個經驗豐富的程序員,我的課程和主要方法都是正確的,但是從思想社區版本運行時,它顯示出這個錯誤。 – Nitiraj