Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arrays

 
John Perry
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i'm having problems storing data into an array. I'm trying to store strings and doubles, but the data does not get stored properly.

 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to rethink your addScore method. There is a problem with the logic.
 
John Perry
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will need the method later on for validation.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Perry:
I will need the method later on for validation.

I think Keith is suggesting that there is a problem with the logic inside that method body -- not that the method itself shouldn't be there.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,


your loops are nested.
Guess how many values i can have before the first return.
Here's how addScore looks, if properly indented:



Yours,
Bu.
 
John Perry
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have modified my code, however i do not understand why i'm getting duplicates. If i type in "Judge1" and score "10", then i type in "Judge2" and score "9", i get a duplicate:



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic