Java static member variables and member functions

Basic and C ++ as

  • static member variables and member functions belong to the class rather than an object. accessed via the class name, rather than the inside of the C ++ class name ::
  • General member variable is not defined as private, but public static final can
  • static member functions can not access non-static members can only access static members, but can be accessed by non-static member class object
  • Non-static member functions can access static and non-static members
  • Subclasses can inherit static members of the base class, but save static members in another piece of memory space. That change static member variables of the base class without affecting subclass change the static member variables. static member function will not be dynamic binding.

Java's static will only be members of the modified class, there is no other use of the

Reproduced in: https: //www.jianshu.com/p/d84646328c47

Guess you like

Origin blog.csdn.net/weixin_34347651/article/details/91187867