Is it better to store value as variable or call method again?
问题 Recently, I started learning some Java. From what I've already learned about JVM it looks like JIT makes it pretty fast on operations requiring CPU cycles (i.e. calling a method) but also makes it hungry for memory. So when I need same output from same method as before, is it generally better approach to store the output from before in variable and use it again - while holding it in memory all this time - or call the same method again? 回答1: It is better practice to hold the output in a