• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Can Not Compile - Help!

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code that is for a insertionsort, problem is I think my code looks good but I can not get it to compile? I do not see what I am missing ? Any ideas what I am missing ? Thank you everyone for all the help.

 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what do you mean by 'not compile'? what, EXACTLY, is the error message? The easier you make it for us, the more likely someone can help you.
 
G. Graz
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry , Running my code with out errors ? I use textpad and I am getting this message:

array required, but E found
for(s = i; s > 0 && t.compareTo(t[s - 1]) < 0; s--)



Ok, sorry I thought "Compile" was a common term ?

Greg
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And when you get that message, the ^ is pointing to t[s - 1]...

So what exactly is t[s - 1]? Focus on that, and you will see that the error message is telling you exactly what the problem is.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Greg Grazioli:
Ok, sorry I thought "Compile" was a common term ?


Ofcourse it is, but Fred means: tell us exactly what the error message is that the compiler gives you (copy and paste it from the command prompt, for example) - if you only say "it doesn't work", then it's much more work for anyone who's reading your question to find out what might be wrong. In other words, tell the details.
 
Sheriff
Posts: 22895
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marc is right - you're mixing up two variables.
 
fred rosenberger
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you said 'can't compile', that could mean:

Your OS can't find the javac.exe
Your OS can't find various classes
Your OS can't find your .java class
the compiler returns an error

and probably a few other things. Each of these things requires a different path to diagnose and fix. And if it is the last one, the error message give TREMENDOUS amounts of details on what the problem is, and WHERE it is. Posting that (since you already have it) saves anyone who wants to help you the trouble of copying your code into their editor, saving it, then compiling it yourself.

If you had posted that error message in your original post, it could have saved lots of time for the folks helping you.
 
See where your hand is? Not there. It's next to this tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic