zoukankan      html  css  js  c++  java
  • Static Nested Classes

     

    As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class: it can use them only through an object reference.


    Note: A static nested class interacts with the instance members of its outer class (and other classes) just like any other top-level class. In effect, a static nested class is behaviorally a top-level class that has been nested in another top-level class for packaging convenience.

    Static nested classes are accessed using the enclosing class name:

    OuterClass.StaticNestedClass
    

      

    For example, to create an object for the static nested class, use this syntax:

    OuterClass.StaticNestedClass nestedObject =
         new OuterClass.StaticNestedClass();
    

      

  • 相关阅读:
    免密码远程登录和远程操作
    1、linux网络服务实验 用PuTTY连接Linux
    巧用CAS解决数据一致性问题
    第一天
    图像处理02
    图像处理01
    Poem 01(转)
    CS229 Lecture 01
    日本語1
    latex测试
  • 原文地址:https://www.cnblogs.com/hephec/p/4603686.html
Copyright © 2011-2022 走看看