Results 1 to 2 of 2
  1. #1
    java4amanda is offline Member
    Join Date
    Jan 2012
    Posts
    55
    Rep Power
    0

    Default main method in super or abstract class

    Hi all,


    I wrote a simple code mentioned below and am not able to understand the way the output is generated.



    abstract class Abc

    {



    public static void main(String[] args)

    {


    System.out.println("hii");

    }


    }

    class Cont extends Abc

    {


    }



    When i save the above program as Cont.java file and run it, it displays the output as hii. Can any one explain how did that happen? shouldn't there be runtime exception saying main method not found? Kindly help.

    Thank you.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: main method in super or abstract class

    My comment in Equals still stands.

    I'm closing this thread. Please feel free to ask the question again after going through the link I provided in the other thread.

    db

    THREAD CLOSED

    edit
    Also
    Thread !!
    List Iterator
    Last edited by DarrylBurke; 09-10-2012 at 01:56 PM.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 1
    Last Post: 10-17-2011, 01:00 AM
  2. abstract method-abstract class
    By durgaprasad1407 in forum New To Java
    Replies: 1
    Last Post: 04-29-2011, 06:58 PM
  3. Replies: 4
    Last Post: 04-14-2011, 11:42 AM
  4. Replies: 5
    Last Post: 01-26-2011, 06:38 PM
  5. Replies: 6
    Last Post: 02-11-2009, 10:51 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
  •