Maximum number of local variables in a Java Method
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 StackOverflowError
and exit.
There is good lecture by a stanford professor which may help you.
This will really be defined by your runtime and how much stack space is allocated, per process.