Java Programming Tutorial - 6 DOUBT

+2 allen george · December 26, 2014
when i create the scanner object it says it is not closed. please help?

Post a Reply

Replies

Oldest  Newest  Rating
+2 Neil Cannon · December 26, 2014
Use this in your program.

import java.util.Scanner;

            Scanner Example = new Scanner (System.in);

            Example.close();
0 allen george · January 8, 2015
thanks for the tip
but, it still says there is a resource leak.
0 Neil Cannon · January 13, 2015
Must still need closing somewhere?
0 Kuroodo Ditory · January 14, 2015
public static void main(String[] args){
Scanner myScanner = new Scanner(blah blah);

// Rest of programs code or whatever


// Do this when you don't need the scanner anymore
myScanner.close();
}
+2 Developer John · January 14, 2015
Can you post your code please?
0 allen george · June 9, 2015
now i get it i wrote Example.close() instead of the actual name
0 Developer John · June 9, 2015
XDXDXD
  • 1

Java / Android Development

107,070 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator