import java.util.Scanner;


public class Lab7 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int counter = 0;
        String[] letters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
        final int ROW;
        final int COL;

        System.out.println("Please enter the total number of rows: ");
        ROW = scan.nextInt();
        System.out.println("Please enter the total number of colums: ");
        COL = scan.nextInt();
        int [][] nums = new int [ROW][COL];


        for (int r = 0; r < ROW; r++){
            for (int c = 0; c < COL; c++){
                System.out.print(letters + " ");
            }
            System.out.println();
            counter++;
        }




    }

}

First I have to prompt the user for total rows and colums (which I have). Next, I'm trying to generate random, capital letters formatted in rows and colums, which I cant generate, its giving some weird error. Lastly, the user has to be able to more charts without restarting the program. Any help would be appreciated

Recommended Answers

All 2 Replies

its giving some weird error

Java error mesages may look weird but they usually tell exactly what the problem is and exactly where it's happening. Please post the complete exact text of your errors and someone will help.

are you sure it's an error?
I see that you print your array, instead of just an element of it, that might be your problem.

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.