Debugging: how to "sneak" into another class object declared in a class

I have a loop in a class (class A) that sets string data to another class (class B) that has setters and getters, calling the setter method of another class (class B), creating a new variable every time like this

  for (int i = 0; i < array.length(); i++) {
                    JSONObject jsonObject1 = array.getJSONObject(i);
                    modelClass = new ModelClass();
                    modelClass.setString(jsonObject1.getString("some"));
                    .
                    .
                    .
                          }

      

I want to see what is the current value of the variables declared in the modelClass (of which im is set) and the updated value after calling the set method, how can I do this with the debugger

+3


source to share


1 answer


Just hit "step" in F5 by default in eclipse debugger. It will send you to the desired setter if you have sources.

String tempString = jsonObject1.getString("some");
modelClass.setString(tempString);

      



Use this style: call your methods one per line and debugging will be easier. Debugging is a big part of programming. I don't know why new technologies don't focus on simple debugging. For example, Java 8 is very difficult to debug - only with the appropriate code style can you debug it.

+1


source







All Articles