Wednesday, 7 November 2018

public vs private vs protected in java

public: Anyone can access public instance variables.
protected: Only methods of the same package or of its subclasses can access protected instance variables.
private: Only methods of the same class (not methods of a subclass) can access private instance variables.
• If none of the above modifiers are used, the instance variable is considered friendly. Friendly instance variables can be accessed by any class in the same package

1 comment:

  1. Sands Casino: Play Slots, Blackjack, Roulette, Video
    In-depth review of Sands Casino including popular deccasino slots, table games, live dealer games, mobile 카지노 betting, mobile 샌즈카지노 bonuses, and more. Rating: 3.9 · ‎3 votes

    ReplyDelete