Resource leak: 'sc' is never closed error in java Code Answer
Categories executing the interface java.io.Closeable (since JDK 1.5) and java.lang.AutoCloseable (since JDK 1.7) are observed to show out different means, which should end like the process of method close(), when these are no more required. The Eclipse Java compiler is clever to examine while code of these kinds claims to this policy. Resource leak: 'scanner' is not at all ends. The condition in which someone is not able to switch off the java util. Scanner object after examining the information,you will achieve a warning that scanner will never switch off.
resurce leak java
on Jan 01, 1970
public void readShapeData() throws IOException {
Scanner in = new Scanner(System.in);
try {
System.out.println("Enter the width of the Rectangle: ");
width = in.nextDouble();
System.out.println("Enter the height of the Rectangle: ");
height = in.nextDouble();
} finally {
in.close();
}
}
0
Note:A susceptibility is reptureness or fault in the application,that is perhaps glitch or an framework insect,it can harm the partner of the application.
Java answers related to "resource leak 'sc' is never closed"
View All Java queriesJava queries related to "resource leak 'sc' is never closed"
Browse Other Code Languages
Abap ActionScript Assembly BASIC C C# C++ Clojure Cobol CSS Dart Delphi Elixir Erlang F# Fortran Go Groovy Haskell Html Java Javascript Julia Kotlin Lisp Lua Matlab Objective-C Pascal Perl PHP PostScript Prolog Python R Ruby Rust Scala Scheme Shell/Bash Smalltalk SQL Swift TypeScript VBA WebAssembly Whatever