這裏是我的類的..如何使用非靜態函數內部靜態函數
public class Oop {
int count = 0;
public static void main(String args[])
{
this.count(15, 30);
System.out.print(this.count);
}
public void count(int start, int end)
{
for(;start<end; start++)
{
this.count = this.count + start;
}
}
}
我不能叫主函數中的計數功能。原因是靜態和非靜態函數。我對Java真的很陌生。我如何使用主內的計數?我需要學習什麼?
,*對錯誤信息搜索* [移除非通用名稱],因爲有很多重複。你*必須*創建一個實例來調用一個非靜態方法。 – user2246674