I understand the importance of Single Responsibility Principle, but technically speaking do we have any upper bound on the number of local variables (that which are stored in stack frames) within each java method. And is that upper bound equal to the maximum stack size, ie., can i have a stack frame of size equal to the maximum stack size configured?
I understand the importance of Single Responsibility Principle , but technically speaking do we
Share
There is no upper bound in defining number of local variables. If you define too many variables which couldn’t fit in a stack frame (or) JVM couldn’t allocate a stack frame for that size, it will throw
StackOverflowErrorand exit.There is good lecture by a stanford professor which may help you.