1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

why a class contains main method has to made public

Discussion in 'Java' started by sakthi.abdullah, Jun 20, 2007.

  1. sakthi.abdullah

    sakthi.abdullah New Member

    Hi
    Why a class containing main method has to made public..?
     
  2. pradeep

    pradeep Team Leader

    public indicates that the main method can be called by any object.
     
  3. shabbir

    shabbir Administrator Staff Member

    I am not a Java expert that reason could be for having the main public but for having the class public the reason could be it can be invoked from any package.
     

Share This Page