I understand that we cannot declare static varibles in function definitions in java unlike in c++ that can retain their values between function calls. How can we do this in java, if the function should not accept parameters and should not reference the non-local variables.(this is a question for our assignment). Is there a way around it?can we declare static variables in c# lik in c++?
thanks in advance.