看板 java 關於我們 聯絡資訊
※ 引述《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