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
    10

    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
    14,372
    Blog Entries
    7
    Rep Power
    25

    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
    The only person who got everything done by Friday was Robinson Crusoe.

  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
    14,372
    Blog Entries
    7
    Rep Power
    25

    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
    The only person who got everything done by Friday was Robinson Crusoe.

  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
    14,372
    Blog Entries
    7
    Rep Power
    25

    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
    The only person who got everything done by Friday was Robinson Crusoe.

  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, 03:51 PM
  2. Replies: 1
    Last Post: 11-20-2009, 08:58 PM
  3. Replies: 6
    Last Post: 07-16-2009, 03:30 PM
  4. Replies: 1
    Last Post: 07-16-2009, 10:35 AM
  5. Replies: 1
    Last Post: 08-07-2007, 07: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
  •