Does closing Scanner affect performance
问题 I was solving a competitive problem and in problem, I was taking user input using scanner. These are 2 code segments, one closing scanner and one without closing scanner. Closing scanner import java.util.Scanner; public class JImSelection { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = Integer.valueOf(scanner.nextLine()); while (n-- > 0) { double number = (Math.log(Long.valueOf(scanner.nextLine())) / Math.log(2)); System.out.println((int) number -