can someone tell me why it is telling me that class Bomb doesn't exist because it does. here is my code:

import java.io.*;


public class MineSweep1
{
	static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	static private Bomb[] bmbArry1 = new Bomb[5];
	static private Bomb[] bmbArry2 = new Bomb[5];
	static private char matrix[][];

	public static void main(String[] args) throws IOException
	{
		int x,y;
		matrix = new char[x][y];
		boolean explode;
		explode = false;

		for(x=0;x<bmbArry1.length;x++)
			for(y=0;y<bmbArry2.length;y++)
			matrix[x][y] = '*';
			System.out.println("");

		while (! (explode))
		{
			for(x=0;x<bmbArry1.length;x++)
			   for(y=0;y<bmbArry2.length;y++)
			      System.out.print(matrix[x][y]+" ");

			explode = GetUserInput();
		}
	}

	static boolean GetUserInput() throws IOException
	{
		int userX, userY;
		System.out.print("Please enter an X position");
		userX = Integer.parseInt(input.readLine());
		System.out.print("Please enter an Y position");
		userY = Integer.parseInt(input.readLine());

		return IsItABomb(userX, userY);
	}

	static boolean IsItABomb(int X, int Y)
	{
		boolean bigboom;
		if(bmbArry1.GetXpos() == X)
			bigboom = true;
			else
			return false;

		if(bmbArry2.GetYpos() == Y)
			bigboom = true;
		else
			return false;

	}
}

and the error i am getting is:

F:\JavaAssignments\Minesweep\MineSweep1.java:49: cannot find symbol
symbol  : method GetXpos()
location: class Bomb[]
		if(bmbArry1.GetXpos() == X)
                           ^
F:\JavaAssignments\Minesweep\MineSweep1.java:54: cannot find symbol
symbol  : method GetYpos()
location: class Bomb[]
		if(bmbArry2.GetYpos() == Y)
                           ^
2 errors

Tool completed with exit code 1

because you have mad a bomb array but you are not telling it which element to Getpos on...

you would need something like this for you method
static boolean IsItABomb(int X, int Y, int elementInArray)
then you could tellit which element you were trying to referance in the array


or stick the check in a for loop which would checkj the coordinates againts each bomb array element, and if it finds it then it would go bang

static private Bomb[] bmbArry2 = new Bomb[5];

do you have a file called Bomb.class in the same folder as this file? If it isn't place it into the same directory and then compile it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.