This article gives you a comprehensive understanding of Java object serialization and deserialization>>>
When using the scanner class, for example:
1 import java.util.Scanner;
2 public class data {
3
4 public static void main(String[] args){
5 Scanner i=new Scanner(System.in);
6 float j=i.nextFloat();
7 System.out.println(j); 8 }
9 }
A warning appears
Resource leak: 'i' is never closed
error reason: the data input scanner named I is declared, so as to obtain the configuration memory,
but the memory is not closed or released at the end, and a warning appears. Therefore, I. close () is used at the end of the mian function; End the data stream and free the memory
Similar Posts:
- How to Solve Error: Scanner class java. Util. NoSuchElementException exception
- Solution to the problem of Java program “resource leak: ‘SC’ is never closed” in vscode
- java.net.SocketException: socket closed
- Java – Stream has already been operated upon or closed
- Java error: No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- JAVA: scanner Read File encoding Error noSuchElementException
- Java – Convert bytes to unsigned bytes
- R6010 -abort() has been called error analysis and solutions
- Spring boot project integration redisson throw exception NoClassDefFoundError: lorg / nustaq / serialization / fstconfiguration
- [Solved] PHP Error: always_populate_raw_post_data = -1