作者hpeter (hpeter)
看板java
标题Re: [问题] static method
时间Mon Jun 19 17:39:36 2006
※ 引述《justinC (无)》之铭言:
: 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则不需用呢?
小弟觉得 因为被 static function 用到的东西
一定要有static 之修饰
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.25.101.82