• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

More help on java modifications

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. Thanks for everyones assistance on this problem. Again, I am working on making two modifications to the program. The first is to Ignore cases, which I have successfully completed. The second is to Use a command-line argument. I have utilized suggestions on using the command-line argument into the program and have implemented them into my program. My program compiles, but I get the following error message when I run the application: Exception in thread "main" java.lang.NoSuchMethodError: main. Could anyone offer any more suggestions or insight on this. Thanks.
Here is my code before using the command-line argument:

Here is my code after using a command-line argument, which I get the NoSuchError method when trying to run the application.

[ October 12, 2003: Message edited by: Troy Johnson ]
[ October 12, 2003: Message edited by: Troy Johnson ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only the "Palindrome" class has a main(), so you can only run that class -i.e., "java Palindrome". If you try to run "problem" you'll get this error. (Not sure what the other class is for, actually.)
 
Ranch Hand
Posts: 218
VI Editor Ruby Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually the second code does not compile, because the main() method is in Palindrome class and it was declared with default access modifier. Instead you have your problem class declared as public.
You should declare your Palindrom class as public instead of problem.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You only need that part of code I posted in your other thread, and run it with an argument
 
Troy Johnson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael, thanks for your help. I guess I am still a little unclear on running an argument to that code? Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic