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();
    

      

  • 相关阅读:
    简单的逻辑学 笔记
    中国古代文化常识 笔记
    Docker 使用官方镜像
    Docker 入门 之基本命令
    Windows.form增删改查
    自定义控件
    LISTVIEW
    窗体布局
    计算器
    登录
  • 原文地址:https://www.cnblogs.com/hephec/p/4603686.html
Copyright © 2011-2022 走看看