This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please decode error message.

 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand this error message. What is it trying to tell me?
Attempt to reference method length in class java.lang.String as an instance variable.
here is the offending code.
int wordlength = args[0].length;
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind I found it. It wanted
args[0].length(); instead of args[0].length;
Now here is a another one.
Starting application F:\Progs\java\repeater\Repeater.class
java.lang.NoSuchMethodError: main
Exception in thread "main" Interactive Session Ended
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind again. Found out that the
public void main() had to be static as in
static public void main()
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's cool. A thread where someone has answered all of their own questions. This would be a good start for a "Common Problems FAQ" for Java.
I've always desired a "Lessons Learned" doc of some kind wrt Java. . .
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is really needed is a decent error message. Why can't the error messages be clear? Why can't they tell you exactly what was expected and what was delivered? That way we can try and fix the problem instead of trying to figure out what the compiler is trying to tell us.
 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're with you brother Tim!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic