so in the below code if exampleVar when first printed out would be zero then once printed out again, would be two yes? I am trying not to use a global variable and other than this, I cannot think of another way.
public int method ... {
int exampleVar = 0;
System.out.println(exampleVar); // would be zero
pmethod(exampleVar,);
System.out.println(exampleVar); // would be two?
}
private int pmethod(int exampleVar) {
exampleVar++;
if(exampleVar != 2){
pmethod(exampleVar);
}
}
the answer people are saying this one is a duiplicate of is not valid, as that answer although correct is far too noisy. using foo examples which are completely abstract and confusing. I have rejected that question as a Java novice as it isn't a clean and clear answer.