java - Creating a 2D array of a class that returns an array of char -


i have been trying desperately create 2d array of chars using classes keep getting stuck @ same point printed array combination of letters , numbers. have tried using tostring() system.out.print(board) not seem make difference. have functional version of program using array of chars. however, task have complete requires printing chars using array of class (in case gameitem).

my display method follows:

private void display(){     board = new gameitem[4][4];     for(int i=0; i<board.length; i++) {                   for(int j=0; j<board.length; j++) {                          board[i][j] = gameitem.gold;                                 system.out.print(board);         }               system.out.print("\n");     }     } 

and gameitem class contains:

public class gameitem {      static gameitem gold = new gameitem ('g');           public gameitem(char c){}        } 

note required use constructor.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -