This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I must admit, I'm a bit confused as to exactly what you're trying to do here. Some issues:
- If you want to use new Dice(), you need a Dice class. Where is it?
- If the Die2 class is supposed to represent a die, so that you can create several of them, then why are all the methods static? The class should have a non-static state (a private int upperFace would be fine), and then I'd expect most of the methods to refer to that state.
- You have (twice) declared UpperFace as a method-local variable, but then you're trying to refer to it in getUpperCase(). It's not visible there.
- You aren't consistent with your use of capitalisation. Following Java conventions, methods and variables should start with a lower-case letter
Here's one way of defining a simple Die class that could be used by your main class:
Joined: Mar 17, 2011
Yes I realize I am not understanding this very well. Thanks for your help. I am hoping that things start clicking for me soon.
Here is what I have after the suggestions. Still now working as I expected. If you could point out my errors again I will keep trying.