Scanner -> nextInt not found

When I run the code in the IDE it’s giving an error that nextInt does not exist.
I am initializing the scanner class as follows :
Scanner scan = new Scanner(System.in);

@fazer,
Are you importing the scanner class?
If not, then please add import java.util.*; at the top of your code.

If the problem persists, please share your code.

Yep, I did include that
Here’s My code :

import java.util.*;
import java.util.Scanner; //Added cause of the same error

public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();

	int row = n*2 + 1;
	int nos = n*2 -1 ;
	int nost = 1;
	int cr =1;
	while(cr <= row){
		//First Stars
		int stc = 1;
		while(stc<=nost){
			System.out.print(n - (stc-1));
			stc++;
		}	
		//Number of Spaces
		stc = 1;
		while(stc<=nos){
			System.out.print(" ");
			stc++;
		}

		//Second Stars
		
		if(cr == n+1)
			while(stc <=nost -1 ){
				System.out.print("*");
				stc++;
			}
		else
			while(stc<= nost){
				if(cr<= n)
					System.out.print(n - cr + stc);
				else
					System.out.print(stc);
				stc++;
			}

		if(cr<= n) {
			nos--;
			nost++;
		}
		else{
			nos++;
			nost++;
			}
		System.out.println();
		cr++;
	}
}

}