Getting a error scan is never closed

Trying to learn this program -

package PatternPrograms;

import java.util.Scanner;

public class pattern2 {

public static void main(String[] args) {

	Scanner scan = new Scanner(System.in);
	int n = scan.nextInt();

	// variable for rowws
	//int rows = 1;
	for(int rows = 1;rows <= n;rows++) {
		// work
		for (int col = 1; col <= n; col++) {
			System.out.print("*");
		}
		// preparation
		System.out.print("\n");
		//rows++;
	}

}

}

//error :- getting a error scan is never closed

@Nitya_Somani hi nitya, its working fine for me, i think you are getting a warning, what you can do is add scan.close() at the end and it will be resolved.

If your query is clear close the doubt by marking it resolved and rate full!

No the program is not working even after adding scan.close();

@Nitya_Somani provide me the screenshots of the logs!

@Nitya_Somani nitya that is not an error just a warning, the code should work fine! you may even see the same in other codes, have you tried running it?

okay okay got it I got confused because the console window was not opening then i opened from windows so now its working … thanks now it is working !!

@Nitya_Somani close the doubt by marking it resolved and rate full!