title: Possible to count amount of outputs from System.out.println, Java?
body: <p>due to a complex issue which I do not want to enter here, I am not able to count a number of created objects(let's say apples) in a complex Java class, using a simple counter as soon as an apple is created. Therefore I was thinking of an alternativ but do not know how to realize it; if it is at all an option:</p>
  
  <p>A for-loop connected to System.out.println("Apples:" + apples) gives me as many outputs as there are apples. - Which is fine. Now I have to store the number of outputs in a variable - how would you do this - is it possible at all, as the output is displayed in the console?</p>
  
  <p>Thanks in advance!</p>