Re: [問題] 關於 reflection
※ 引述《loveflames (.....)》之銘言:
: ※ 引述《qrtt1 (愚人)》之銘言:
: 那個網站之前已經去過了
: 一開始是用object_name.getClass().getName()
: 可是物件不是都要先預設類別嗎?
: 這樣不是變成了要先知道有什麼檔
: 而不能用字串來直接設定物件類別?
==站內==
Java檔 = 字串?
= 類別?
看你的原文我會想回你,
用IO把 .java load進來做parse Class name的動作。
如果你一開始是說用 "字串" 設定物件類別,
你可以早一天得到很直接的解答。
雖然"設定"這個字眼還是很模糊,
可以分成取得實體和取得class兩種。
--
要問問題的人請把問題敘述清楚啊,
不想要答案就不要上來亂槍打鳥浪費別人時間~
置底文章有寫清楚 [站內] 、 [看板]的差別,
所謂入境隨俗這回事,盼君珍重。
--
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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):