This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoSuchMethodError" Watch "NoSuchMethodError" New topic
Author

NoSuchMethodError

Jade Davidson
Ranch Hand

Joined: Oct 12, 2001
Posts: 64
As part of another (long) program, I am trying to print the alphabet. But I am getting a NoSuchMethodError in main() and I don't know why. Below is my source code:
public class Name {
public static void main(String[] args) {

for (int j = 0; j <26; j++)

System.out.println('a' + 26);
}
}
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
I dunno why you're getting the NoSuchMethodError; I can compile and run your code snippet fine. You may have to display more of your code to get the source of the error.
And as an added hint, to do what you're wanting to do:
I think you want to replace 26 with j in your println() call.
Before printing, you'll want to cast your sum to a char. Otherwise, your output will get cast up to an int.
Good luck debugging the error,
Art
[This message has been edited by Art Metzer (edited November 13, 2001).]
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Taking what you have there, it ran for me. Doesn't do what you want but it did run with no errors.
Wilfried LAURENT
Ranch Hand

Joined: Jul 13, 2001
Posts: 269
Originally posted by Jade Davidson:
But I am getting a NoSuchMethodError in main() and I don't know why.

Please, saying you are getting a NoSuchMethodError is not very helpful, but, good point for you, you gave the source code. Normally you had the whole error stack displayed in your output window. May be you could provide us with the whole message?
W.
 
Don't get me started about those stupid light bulbs.
 
subject: NoSuchMethodError