تعیین سطح دسترسی در جاوا

  • Access specified specified the accessibility of the members.
  • access specified can be used before a method, constructor, variable, constant, class and other structures.
  • java can support  4 types of access specifides: 1-public 2-private 3-protected 4-default
  • the public describes the accessibility as global. that means any one can use public members.
  • private accessibility is only within the class. the same class members can be access private members.
  • default: if we will not mention any access specified, as public, private or protected then java compiler identify the access specified as a default. there is no keyword for default accessified. the default member is available/accessible only within the package and outside the package it is private. it means inside package it is public else it is private.
  • protected is same as Default. but can be accessible through sub class out side of the package.
  • we can create private, for the inner class not for the class.


نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد