作者TonyQ (骨头)
看板java
标题Re: [问题] JAVA的call by value
时间Sat Mar 24 22:48:15 2007
※ 引述《drinks (不告诉你..)》之铭言:
: ※ 引述《ldg (ldg)》之铭言:
: : class student{
: : static void print(){
: : ...
: : }
: : student.print();
: : }
: : }
: 小弟我刚学java不久 ,说错请见谅喔..
: 请高手指教了.
: 第一行应该要加 public,
同物件内引用 加不加都无所谓
要看他有没有要发布给外部class决定要不要加public
: student.print(); 这行的意思是?
: 如果要使用print(),应该是用s[] 来呼叫才是
: 你的程式码 并没有叫做student的实体.
print是static方法
由类别所拥有 而非instance所拥有 (你指的物件实体)
--
建议你先看完修饰字的章节,这部份的概念很基本。
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the compiler will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68