Which of the following is correct about a local variable?
1) It is declared before all the methods in a program.
2) It is visible to all the methods declared after it.
3) It is declared exclusively in the main method.
4) It is declared within the scope of any method.

Q&A Education