Results 1 to 3 of 3
  1. #1
    rmurali.mcp is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default What is the use of marking Instance variable to private

    What is the use of marking Instance variable to private..
    Why not to mark as public

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,807
    Rep Power
    10

    Default

    For starters, so it cannot be changed without error checking. This has been asked and answered multiple times. Please search before asking questions like this in future.

  3. #3
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    8

    Cool

    Quote Originally Posted by rmurali.mcp View Post
    What is the use of marking Instance variable to private..
    Suggested reading : Java - Encapsulation

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. Replies: 3
    Last Post: 05-05-2011, 03:33 PM
  2. Replies: 1
    Last Post: 12-09-2009, 01:57 AM
  3. Array of objects, as an Instance variable
    By blaklite in forum New To Java
    Replies: 2
    Last Post: 03-25-2009, 01:56 AM
  4. Instance Variable In Servlet
    By javarishi in forum Java Servlet
    Replies: 3
    Last Post: 06-14-2008, 08:28 AM
  5. Instance variable
    By Jack in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 04:00 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
  •