• Post Reply Bookmark Topic Watch Topic
  • New Topic

Advanced Array Concepts  RSS feed

 
Elizabeth Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did I do wrong in my code?


 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I can see lots of things. But I am sure you were thinking of something different from what I saw. You ought to tell us the details otherwise we can't help.
 
Elizabeth Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the assignment:

Write an application containing an array of 10 String values, and display them in ascending order.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elizabeth Koch wrote:Here is the assignment:

Write an application containing an array of 10 String values, and display them in ascending order.

You still need to TellTheDetails. Does your code compile ? Does it do something that it is not supposed to do ? Does it not do something that it is supposed to do ? Does it cause a blackhole to appear and swallow up your computer ?
 
Elizabeth Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what happens when I run the program:
CarolbobAlice
AliceCarolbob
AlicebobCarol
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
array cannot be resolved to a variable

at SortString.java.StringSortExample.displayList(StringSortExample.java:41)
at SortString.java.StringSortExample.main(StringSortExample.java:25)
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Eclipse shows you red marks against the code, don't try to execute it.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elizabeth Koch wrote:array cannot be resolved to a variable

Where do you declare the variable array that is used on line 41 ?
Compare it with line 34 which is identical but doesn't give you an error.
 
Elizabeth Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I figured it out. Thanks, and it ran correctly!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!