I'm declaring an object like this:
Response getMessagesResponse;
if (page == 0) {
getMessagesResponse = myRequest.newCall(getMessagesRequest).execute();
System.out.println("response "+getMessagesResponse.body().string());
The code above will print an empty string, no matter how times I run it. Now, if I assign and call the object at the same line, like this:
if (page == 0) {
Response a = sisgradRequest.newCall(getMessagesRequest).execute();
System.out.println("response "+a.body().string());
it will work. Why? I've always did things like this in java and had no problem. The newCall method here is from the OkHttp3 java library.
UPDATE:
before System.out.println() in the first code, I had this line:
this.magicalNumber = getMagicalNumber(getMessagesResponse.body().string());
turns out that if I put System.out.println() before it, I get the print. If i put after it, I don't get it. Why? Maybe because jSoup inside getMagicalNumber processes the data and then erases it from the main object?