This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Can Not Compile - Help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can Not Compile - Help!" Watch "Can Not Compile - Help!" New topic
Author

Can Not Compile - Help!

G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
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.

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
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
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Marc is right - you're mixing up two variables.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can Not Compile - Help!
 
Similar Threads
Updated MulitThreads Problem
writing generic sort method
warning: [unchecked] unchecked method invocation
Simple J2SE 5.0 Tiger Notes