作者justinC (无)
看板java
标题[问题] static method
时间Mon Jun 19 17:35:28 2006
public class test {
public static void main(String args[]) {
System.out.print(more(2,4,4,4));
}
public static int more(int... num)
{
int total=0;
for(int a:num)
total+=a;
return total;
}
}
为什麽在class test底下
more method一定要加static 才能给过?
而其他class则不需用呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.221.120.127