Ale when you post a question, then you must also tell from where did you copy the question. Here now we know that it is from Examlab, but for future keep in mind to disclose the name of the mock exam from where you post a question
Ben Zaidi wrote:Well, i saw the first post. I am wondering why
System.out.print(ga.i + " " + ga.getI())
will first evaluate the getI() method. I am confused, can anyone clarify this doubt please?
is evaluated this way:
so to append ga.getI(); first ga.getI() is evaluated completely that prints "Sub", and after that whatever returned by ga.getI() is appended to ga.i value and space value, then converted to String from StringBuilder than printed.