Difference between declaring a variable before or in a Java loop.

Java 8Object Oriented ProgrammingProgramming

Performance wise, there is hardly any difference. But it is good to keep a variable local to the scope it is used. So declaring a variable inside Java loop is generally preferred.

raja
Updated on 30-Jul-2019 22:30:21

Advertisements