This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes implementing objects in a private class to an array constructor... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "implementing objects in a private class to an array constructor... " Watch "implementing objects in a private class to an array constructor... " New topic
Author

implementing objects in a private class to an array constructor...

Johnny Steele
Greenhorn

Joined: Nov 12, 2010
Posts: 12


hey everyone. So i'm working on my own version of mineSweeper. My professor's explanation, even after several times asking, doesn't seem to quite click with me. In the following code, I have to implement the MineSweeper constructor and my needed instance variable in it. So I've been told the constructor is taking an array of GameSquare objects. My question is: how do I initialize the information within each object if the GameSquare class if Private? Then, how do I call this array later in order to set the my other methods such as isFlagged, click, and so on? Just need a push in the right direction and some clarity, I'm quite confused. Thanks!!! Oh, this method is being implemented in such a way so that I can do some unit testing. There is another constructor using a random number generator but I believe the point of this one is testing.


as you can see I started but have no idea what i''m doing.
-Thank you ahead of time.


el Duderino
Johnny Steele
Greenhorn

Joined: Nov 12, 2010
Posts: 12
I found that I had to instantiate all the variables in the private class. Took me a while to figure out!!!

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

We'd even appreciate it if you'd post your solution, so others can learn from your experience.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: implementing objects in a private class to an array constructor...
 
Similar Threads
Drawing Problems with JPanel /Jframe need optimize solution.
Block Sliding Puzzle
jtable
JTable Cell Editor Problem
Someone, everyone, PLEASE HELP ME ON A PROJECT!!