can't assign random number to array

So i am having problems with my code here. What I am basically trying to do is assigning a value to each BC[0] and adding 1 to BC01[0] and 2 to BC02[0] doing that for each boat. (trying to make battleships (advanced))

but all i am able to print out is


Anyways, here is my code

public class dogs {
    public static int BC00 [] = {0,0};
    public static int BC01 [] = {BC00[0],BC00[1]};
    public static int BC02 [] = {BC00[0],BC00[1]};
    public static int boat0[][] = {BC00, BC01, BC02}; //location cells boat[0][0]
    public static int BC10 [] = {BC01[0], BC01[1]};
    public static int BC11 [] = {BC01[0], BC01[1]};
    public static int BC12 [] = {BC01[0], BC01[1]};
    public static int boat1 [][] = {BC10, BC11, BC12};
    public static int BC20 [] = {BC02[0], BC02[1]};
    public static int BC21 [] = {BC02[0], BC02[1]};
    public static int BC22 [] = {BC02[0], BC02[1]};
    public static int boat2 [][] = {BC20, BC21, BC22};
    public int NH; // Number of hits
    public static int allBoats [][][] = {boat0, boat1, boat2};
    public static int rand;
    public static int n = 0;
    public static void main(String[] args) {

        for (int x = 0; x <= 2; x++) {
            Random gen = new Random();

            rand = gen.nextInt(6) + 1;
            allBoats[x][0][0] = (int) rand;
            while(n <= 2) { //give boatCells locations

                allBoats[n][1][1] = allBoats[n][1][1] + 1;
                allBoats[n][2][1] = allBoats[n][2][1] + 2;
            } // end of while loop
        } // end of For loop
    } // end of public static void main(String[] args)
} // end of dogs class




instead of


And as @ChristianKuetbach has suggested, it is important to understand that in Java, toString()-Mothod often does not mean "A mothod to generate a user-readable String". Most classes prints ClassName@HashCode.

Need Your Help

Crossfilter: how to remove or filter values from group

javascript crossfilter

I'm trying to get a group with the sum of values of a csv file, but I want to remove all the zero values.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.