• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling error

 
julia lamenza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this code

and when i try to copile this they say that i have an error in tthe int part
please help
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change .lenght to .length
 
mike ryan
Ranch Hand
Posts: 210
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


you should spell length properly , also you should use code tags to post your code, it is easier to read. And start your own thread to get help rather than jumping in to an older post to get more attention to your problem rather than the problems from the older post that have already been taken care of.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12100
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike ryan wrote:you should use code tags to post your code, it is easier to read. And start your own thread to get help rather than jumping in to an older post

Agreed. i took care of both.

Julia - next time, please use code tags. They make your code much easier to read, assuming your code is formatted with proper indentation. They work the same way as the 'italic' or 'color=red' tags work. Simply highlight it and click the 'code' button.

Personally, i wouldn't have these three lines at all:



but would instead do this:


My reasoning is that

1) it is possible that in between getting the length and using it, your array could change. Granted, not with the code you have here, but it is possible.
2) why store the same value twice? You can get the length(s) whenever you need it, so why get it and store it again? It's just redundant data.
 
julia lamenza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic