File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 19693
    
  20

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...