Results 1 to 4 of 4

Thread: help me

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,375
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by pavankumar2215 View Post
    why a class cannot be private?
    Top level classes can only have package scope visibility or it can be public. Nested classed can have any visibility, read the tutorials for a longer explanation.

    kind regards,

    Jos

  3. #3
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    i cant get you
    can you please help me in an simpler way

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default

    If a top level class (that is the class named after the java file it is in) were private then nothing could use it. Which would mean the code could not be executed, so there's no point having it.

    Non-top level classes can be private.

Posting Permissions

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