I have done ganesha pattern and it is running in eclipse and printing output but online it is not running and showing error

error :
Compiling failed with exitcode 1, compiler output:
Main.java:3: error: cannot find symbol
public static void main(string args[]) {
^
symbol: class string
location: class Main
1 error.

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

	// row
	int row = 1;

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

		for (int cst = 1; cst <= nst; cst++) {

			if (row == ((n / 2) + 1) || cst == nst / 2 + 1) {
				System.out.print("*");
			} else if (cst == 1 && row == 1) {
				System.out.print("*");
			} else if (row == 1 && cst >= nst / 2 + 1) {
				System.out.print("*");
			} else if (row > 1 && row <= n / 2 && cst == 1) {
				System.out.print("*");
			} else if (row > n / 2 + 1 && row < n && cst == nst) {
				System.out.print("*");
			} else if (row == n && cst <= nst / 2) {
				System.out.print("*");
			} else if (row == n && cst == nst) {
				System.out.print("*");
			} else {
				System.out.print(" ");
			}

		}
		// preparation
		System.out.println();
		row++;
	}

Hi Nipun

At the starting of your code, write

import java.util.*;

Then the code will work fine and pass all the test cases too.

i have done everything but online code is not running but the code is running in the eclipse

submission link
https://online.codingblocks.com/player/19118/content/5025?tab=submissions

Hi Nipun
You need to save your code in the coding blocks ide and then send the link here.
Also, what error are you facing? Are you not able to submit the code or the test cases are not passing?

https://online.codingblocks.com/player/19118/content/5025?tab=submissions

i have submitted my code but,
it is running properly in eclipse but,
it is showing error in online ide
submission link: https://online.codingblocks.com/player/19118/content/5025?tab=submissions
Submission #1951828

Hi Nipun

This is the link to your course and not the code. I think you are having trouble sending the code.
The other thing you can do is write your code between the code tag and send it here.

my code

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

	// row
	int row = 1;

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

		for (int cst = 1; cst <= nst; cst++) {

			if (row == ((n / 2) + 1) || cst == nst / 2 + 1) {
				System.out.print("*");
			} else if (cst == 1 && row == 1) {
				System.out.print("*");
			} else if (row == 1 && cst >= nst / 2 + 1) {
				System.out.print("*");
			} else if (row > 1 && row <= n / 2 && cst == 1) {
				System.out.print("*");
			} else if (row > n / 2 + 1 && row < n && cst == nst) {
				System.out.print("*");
			} else if (row == n && cst <= nst / 2) {
				System.out.print("*");
			} else if (row == n && cst == nst) {
				System.out.print("*");
			} else {
				System.out.print(" ");
			}

		}
		// preparation
		System.out.println();
		row++;
	}

with reference to your first post…
make s of string Capital in public static void main(string args[])

thankyou:+1:
been thinking for days what is wrong in my code even when it is running in eclipse and online IDE