Re: [問題] JAVA的call by value
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 6 之 7 篇):