title: How to call a constructor from main method in java?
body: <p>I need to write a program to solve the eight queens problem and I have no idea how to do it, but I have already started with the multidimensional array. The thing is that I don't know how to call a constructor from the main class, just to check if the array was constructed properly, or how to call it from a method. Can anybody help, please? This is the code, it returns null.</p>
  
  <pre><code>import javax.swing.JOptionPane;
  
  
  public class Eightqueens
  
  {
      private static int[][] board;
  
      public static void main(String[] args) 
      {
          JOptionPane.showMessageDialog(null,board);
      }
  
      public Eightqueens (int size)
      {
          size = 8;
          board = new int[size][size];
  
          int row;
          int col;
  
          for (row = 0; row &lt; size; row++)
              for (col = 0; col &lt; size; col++)
                  board[row][col] = 0;
      }
  
  }
  </code></pre>