Java新手。我在eclipse里面調(diào)試java代碼時發(fā)現(xiàn)expression這個標(biāo)簽頁并不怎么好用。比如這么一個小程序
public static void main(String[] args) {
// TODO Auto-generated method stub
String notion = "{\"name\": \"Bill\", \"age\": 25, \"id\": \"1070329129\", \"friends\":[{\"name\": \"Eric\", \"age\": 30, \"id\": \"12345\"}, {\"name\": \"John\", \"age\": 33, \"id\": \"32154\"}]}";
Gson gs = new Gson();
people p = gs.fromJson(notion, people.class);
System.out.println(p.getName());
System.out.println(p.getAge());
System.out.println(p.getId());
List<people> temp = p.getFriends();
for (int i = 0; i < p.getFriends().size(); i++) {
System.out.println(p.getFriends().get(i));
}
我在getFriends()那里斷點(diǎn)。在expression標(biāo)簽中輸入p.getFriends(), 提示
"temp.size()" <error(s)_during_the_evaluation>
難道一個變量在運(yùn)行時我想調(diào)用一下它的方法都不行嗎?還是應(yīng)該怎么用?
謝謝。
歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~
Your breakpoint is above the temp variable declaration. Of course, the temp variable referenced in the expression at this time does not exist.
If you take two steps down, the expression will have the correct value.