0
what does e.close(); do?
what is the work of e.close(); ?? In this example code, there are no work of e.close(); but what about others? when to use it? and for what? I need a good explaination ☺ Example : import java.util.Scanner; public class GetEqual{ public static void main(String[]args){ int a,b,sum; Scanner e=new Scanner(System.in); System.out.println("Enter 1st Num : "); a= e.nextInt(); System.out.println("Enter 2nd Num : "); b=e.nextInt(); e.close(); sum=a+b; System.out.println("Answer is : "+sum); } }
1 ответ
+ 1
https://www.google.com/url?q=https://www.tutorialspoint.com/java/util/scanner_close.htm&sa=U&ved=0ahUKEwihvebj_9PaAhUD0xQKHQFFAqkQFggLMAA&usg=AOvVaw3w6obaDWp3UOZMQlYj1W3u
https://www.quora.com/Why-do-we-need-to-close-the-scanner-class-in-java&sa=U&ved=0ahUKEwihvebj_9PaAhUD0xQKHQFFAqkQFggYMAM&usg=AOvVaw2UaABtlHsmhfXxA3_MB6f4