Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29
  1. #21
    ravifedora is offline Member
    Join Date
    Mar 2011
    Posts
    14
    Rep Power
    0

    Default

    Sunde,

    it shows the same exception:


    Exception in thread "main" java.lang.NoSuchMethodError: main

  2. #22
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Can you paste the exact error message?

  3. #23
    ravifedora is offline Member
    Join Date
    Mar 2011
    Posts
    14
    Rep Power
    0

    Default

    Exception in thread "main" java.lang.NoSuchMethodError: main

  4. #24
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by ravifedora View Post
    Exception in thread "main" java.lang.NoSuchMethodError: main
    You did recompile your newer attempts before you tried to run them, did you?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #25
    ravifedora is offline Member
    Join Date
    Mar 2011
    Posts
    14
    Rep Power
    0

    Default

    Yes, I did recompile. No luck :(

  6. #26
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by ravifedora View Post
    Yes, I did recompile. No luck :(
    Ok, post the code that generated that error; verbatim please, don't change anything.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #27
    ravifedora is offline Member
    Join Date
    Mar 2011
    Posts
    14
    Rep Power
    0

    Default

    Fruit.java
    --------------


    package food;
    public class Fruit{
    protected void printFruit() {
    System.out.println("aatukutti is too much to handle.");
    }
    }


    Apple.java
    ---------------
    import food.Fruit;
    class Apple extends Fruit{
    public static void main() {
    Apple ap= new Apple();
    ap.printFruit();
    }
    }

  8. #28
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by ravifedora View Post
    public static void main() {
    There's your error; the main method has to have a signature like this:

    Java Code:
    public static void main(String[] args) { ... }
    You have to pay attention to the details; the JVM does it too ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #29
    ravifedora is offline Member
    Join Date
    Mar 2011
    Posts
    14
    Rep Power
    0

    Default

    JosAH,

    in this case I missed the trees for the forest :) thank you so much!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 5
    Last Post: 06-22-2010, 04:51 PM
  2. Replies: 1
    Last Post: 11-20-2009, 08:58 PM
  3. Replies: 6
    Last Post: 07-16-2009, 04:30 PM
  4. Replies: 1
    Last Post: 07-16-2009, 11:35 AM
  5. Replies: 1
    Last Post: 08-07-2007, 08:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •