Discussion:
請回答一下問題好嗎
(时间太久无法回复)
味全龍加油
2006-09-07 15:31:05 UTC
Permalink
謝謝
Is there anyone can answer the following questions for me?
1. May I replace public to private as
private static void main(...){...}

If not, why not

2. May I compile with
private void main(...){...}

that is no static
If not, why not

3. May I switch by this way
private void static main(...){...}


If not why not

Thanks


--
不懂你的心 究竟躲著甚麼
不懂為甚麼要我放開手
不懂愛情為何不長久
好想對你說 說不願就此分手
你只是默默對我搖搖頭
微笑說我們永遠做朋友

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 24.98.113.197
淺水中
2006-09-07 19:05:28 UTC
Permalink
※ 引述《chungyen (味全龍加油)》之銘言:
: 謝謝
: Is there anyone can answer the following questions for me?
: 1. May I replace public to private as
: private static void main(...){...}
: If not, why not
語法是正確的但不能執行

: 2. May I compile with
: private void main(...){...}
: that is no static
: If not, why not
Yes
: 3. May I switch by this way
: private void static main(...){...}
: If not why not
Yes,但一樣不能執行
: Thanks

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.105.36
e :) y
2006-09-08 00:46:51 UTC
Permalink
※ 引述《calais007 (淺水中)》之銘言:
: ※ 引述《chungyen (味全龍加油)》之銘言:
: : 謝謝
: : Is there anyone can answer the following questions for me?
: : 1. May I replace public to private as
: : private static void main(...){...}
: : If not, why not
: 語法是正確的但不能執行
: : 2. May I compile with
: : private void main(...){...}
: : that is no static
: : If not, why not
: Yes
: : 3. May I switch by this way
: : private void static main(...){...}
: : If not why not
: Yes,但一樣不能執行
: : Thanks
yes
不要搞混syntax/semantic的概念
private .. main() 在語法syntax上是對的
但private這個關鍵字的意義semantic上 就是指這個method 只能在class內被使用

所以應該是看你想要有什麼功能的東西 然後寫有意義的東西



--
PLUR

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 84.162.93.139

Loading...