PATTERN 17 using while loop error occurs DUPLICATE VARIABLE

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

	// * * * - * * *
	// * * - - - * *
	// * - - - - - *
	// - - - - - - -
	// * - - - - - *
	// * * - - - * *
	// * * * - * * *
	//

	// row
	int row = 1;

	// work
	int nst = n / 2;
	int nsp = 1;
	while (row <= n) {

		// work stars
		int cst = 1;
		while (cst <= nst) {
			System.out.print("* ");
			cst++;
		}

		// work spaces
		int csp = 1;
		while (csp <= nsp) {
			System.out.print("- ");
			csp++;
		}

		// work stars

		// int cst=1;                     says duplicate variable
		while (cst <= nst) {
			System.out.print("* ");
			cst++;
		}

		// preparation
		if (row <= n / 2) {
			nst--;
			nsp = nsp + 2;
		} else {
			nst++;
			nsp = nsp - 2;
		}
		System.out.println();
		row++;
	}

@nipun95 you have already declared a variable int cst = 1 previously and again you are using the same variable name that is why it is giving the error.
Look at your code below the while(row<=n) you have declared int cst = 1
To use in while loop u just need to change the value of cst variable again.