Question: what are local and global variables in java?
Answer: Global Variable has to be declared anywhere in the class body but not inside any method or block. ... If the variable is declared inside a method or block, it is called local variable. Local variable is available only to method or block in which it is declared.