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