Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8872451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:13:32+00:00 2026-06-14T18:13:32+00:00

My program doesn’t print anything at all. First I initialized the board in a

  • 0

My program doesn’t print anything at all.

First I initialized the board in a seperate class (board):

       public class Board {
          public char board[][] = new char[9][9];   
          public void main(char[] args){

        for(int i=0; i<9; i++){
            board[i][0] = '_';
            board[i][8] = '_';
        }
        for(int h=0; h<9; h++){
            board[0][h] = '|';
            board[8][h] = '|';
        }

        for(int x=0; x>9; x++){
            for(int y=0; y>9; y++){
                System.out.println(board[x][y]);    
            }
        }
    }
}

Then called it in the main, with a PrintLine of “Hello World” to check that the code was being accessed. No errors are flagged up but neither does it print anything at all. The Main is below also just to check that i havent done anything simple and stupid:

    public static void main(String[] args) {  
    Ticker T = new Ticker();
    Board B = new Board();       
    for(int x=0; x>9; x++){
        for(int y=0; y>9; y++){
            System.out.println("Hello World");
            System.out.print(B.board[x][y]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:13:33+00:00Added an answer on June 14, 2026 at 6:13 pm

    Besides the incorrect condition in the for loops you should consider using

    public class Board {
        public char board[][] = new char[9][9];
    
        // this is the constructor, it will be called if you say "new Board()"
        // the "main" method you had here will not be called automatically
        public Board() {
            for (int i = 0; i < 9; i++) {
                board[i][0] = '_';
                board[i][8] = '_';
            }
            for (int h = 0; h < 9; h++) {
                board[0][h] = '|';
                board[8][h] = '|';
            }
    
            for (int x = 0; x < 9; x++) {
                for (int y = 0; y < 9; y++) {
                    // just a print so it does not make new lines for every char
                    System.out.print(board[x][y]);
                }
                // new line once one column (board[x][0] - board[x][8]) is printed
                // note: you proably want to turn around the x and y above since
                // I guess you want to print rows instead of columns
                System.out.println();
            }
        }
    }
    

    It fixes some problems

    • the condition of the for loop that could never be true
    • replaced the main method with a constructor so the code you wrote there is executed
    • changed to print the stuff that is printed in the inner loop in one line, so it looks like a board

    Now if you do

    public static void main(String[] args) {  
        Ticker T = new Ticker();
        Board B = new Board(); // << this line triggers printing
        // ...
    }
    

    you should see some board like thing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to measure stack depth. Why the following program doesn't print anything?
I'm writing a console program. The program doesn't print anything. So, it doesn't need
Why doesn't this work? The program stops on: this.textBox1.Text = (New text); Thread demoThread;
To my surprise in the following program the Eclipse console doesn't print while in
I want to launch a daemon on new thread, to my program doesn't lock
I'm thinking of the case where the program doesn't really compute anything, it just
Statement *p++ = *source++; in the following first program doesn't cause any errors but
The following program doesn't build in VS11 beta, gcc 4.5, or clang 3.1 #include
I cannot figure out why the following simple program doesn't (create) and then write
I have a program which doesn't once reference System.I0, coded in vb.net, yet for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.