I've read Java does not support static
local variables unlike C/C++. Now if I want to code a function with a local variable, whose value should persist between function calls, how do I do that?
Should I resort to using instance variables?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
yes - after all, that is what instance variables are for. They store the state between invocations of the methods of the object. Having static class variables can sort of achieve the same result, but can make your program more coupled and harder to test/mock/maintain.