Re: [問題] Retrieving runtime parameter values
※ 引述《n3oanderson (T. J.)》之銘言:
: Hi
: Java 是否可比在 runtime的時後 抓取 parameter 傳進來的 值?
: 比如說, 有個 function
: public Integer add(Integer a, Integer b){
: Integer c = a + b*2;
: return c;
: }
: 程式執行時 傳入
: Integer result = add(1, 2);
: 是不是 有 method or api 可以取得 a, b (i.e. a=1, b=2) 的值呢?
: 查了 java.lang.reflect.Method 只看到 可取得 parameter type 的method.
: 好像沒有辦法取得 值.
: Thaanks in advice,
呃...你要在哪裡抓這個值?
如果是在caller方抓 你要怎麼知道哪一次的呼叫是你要抓的?
如果是在callee方抓....都傳進去了就直接叫出來就好了啊orz
--
"LPH" is for "Let Program Heal us"....
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.30.84
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 6 篇):