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.
ok, I made some changes. Namely, I made a method in the Team class to set the two variables. Now it compiles just fine, but I'm getting a runtime error: "Exception in thread "main" java.lang.NullPointerException" when I input the first team name... What am I doing wrong now?
I think you may be using an incorrect syntax? What exactly is it you're trying to do here? Get an Array of teams with their wins, etc?
I would use an ArrayList or LinkedList of "Team"s, set the team's information first, and then add the team to the ArrayList. This way if you want to ever add information to the team and, consequently, the array it doesn't cause trouble later....
Someone with more experience might be able to better help you.
When you do things right, people won't be sure you've done anything at all.
You have an array that can reference Teams, set to a size, but you don't actually have any Teams.
Joined: Sep 19, 2009
David Newton wrote:You have an array that can reference Teams, set to a size, but you don't actually have any Teams.
That's actually what I am trying to do on line 34, is to assign the first element of the first team. Do I need to set all the teams to some default value or something and then assign them? How do I assign them all an initial default value of say: "" and 0?