(转)Static Nested Class 和 Inner Class

Nested Class (一般是C++的说法),Inner Class (一般是JAVA的说法)。Java内部类与C++嵌套类最大的不同就在于是否有指向外部的引用上。

  注: 静态内部类(Inner Class)意味着
1 创建一个static内部类的对象,不需要一个外部类对象
2 不能从一个static内部类的一个对象访问一个外部类对象

Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?

Inner Class(内部类)定义在类中的类。
Nested Class(嵌套类)是静态(static)内部类。1. 要创建嵌套类的对象,并不需要其外围类的对象。 2. 不能从嵌套类的对象中访问非静态的外围类对象。

Anonymous Inner Class (匿名内部类)匿名的内部类是没有名字的内部类。

匿名的内部类不能extends(继承)其它类,但一个内部类可以作为一个接口,由另一个内部类实现。

嵌套类可以作为接口的内部类。正常情况下,你不能在接口内部放置任何代码,但嵌套类可以作为接口的一部分,因为它是static 的。只是将嵌套类置于接口的命名空间内,这并不违反接口的规则。

内部类被继承,由于内部类有一个指向外围类对象的秘密引用,所以在继承内部类的时候,该秘密引用必须被初始化。解决方法是enclosingClassReference.super();语法,看一下代码:

class Outer
...{
     class Inner
      ...{
      }
}
class AnoClass extends Outer.Inner
...{
     AnoClass (Outer wi)
        ...{
             wi.super();
        }
}

匿名类(Anonymous Class)
  当一个内部类的类声名只是在创建此类对象时用了一次,而且要产生的新类需继承于一个已有的父类或实现一个接口,才能考虑用匿名类,由于匿名类本身无名,因此它也就不存在构造方法,它需要显示地调用一个无参的父类的构造方法,并且重写父类的方法。

。。。。。。。。。。。。

f.addMouseMotionListener(new MouseMotionAdapter(){ //匿名类开始
       public void mouseDragged(MouseEvent e){
        String s="Mouse dragging: x="+e.getX()+"Y="+e.getY();
        tf.setText(s); }
      } ); //匿名类结束

  存在它的原因是:
  1.一个内部类的对象能够访问创建它的对象的实现,包括私有数据。即内部类实例对包含它的哪个类的实例来说,是特权的。
  2.对于同一个包中的其他类来说,内部类能够隐藏起来,换句话说,内部类不管方法的可见性如何,那怕是public,除了包容类,其他类都无法使用它。
  3.匿名内部类可以很方便的定义回调。
  4.使用内部类可以非常方便的编写事件驱动程序。
其实它真正的目的仅仅为了定义回调--进一步就是事件驱动。

 在使用匿名内部类时,要记住以下几个原则:
  ·匿名内部类不能有构造方法。  
  ·匿名内部类不能定义任何静态成员、方法和类。  
  ·匿名内部类不能是public,protected,private,static。  
  ·只能创建匿名内部类的一个实例。
·一个匿名内部类一定是在new的后面,用其隐含实现一个接口或实现一个类。  
  ·因匿名内部类为局部内部类,所以局部内部类的所有限制都对其生效。

匿名类和内部类中的中的this :
有时候,我们会用到一些内部类和匿名类。当在匿名类中用this时,这个this则指的是匿名类或内部类本身。 这时如果我们要使用外部类的方法和变量的话,则应该加上外部类的类名。

 

静态内剖类:

  1. package  innerClass;   
  2. public   class  OutClass1 {   
  3.      public   int  oid;   
  4.      public  String oname;   
  5.      public   static   class  InnerStaticClass1{   
  6.          public   int  iid;   
  7.          public  String iname;   
  8.     }   
  9. }  
  1. package  innerClass;   
  2. import  innerClass.OutClass1.InnerStaticClass1;   
  3. public   class  Test1 {   
  4.      public   static   void  main(String[] args) {   
  5.         OutClass1 oc= new  OutClass1();   
  6.         InnerStaticClass1 ic= new  InnerStaticClass1();   
  7.     }   
  8. }  

非静态内剖类:

  1. package  innerClass;   
  2. public   class  OutClass2 {   
  3.      public   int  oid;   
  4.      public  String oname;   
  5.      public   class  InnerClass2   
  6.     {   
  7.          public   int  iid;   
  8.          public  String iname;   
  9.     }   
  10. }    
  1. package  innerClass;   
  2. public   class  Test2 {   
  3.      public   static   void  main(String[] args) {   
  4.         OutClass2 oc= new  OutClass2();   
  5.         OutClass2.InnerClass2 ic=oc. new  InnerClass2();   
  6.     }   
  7. } 
FreeRTOS项目:智能手表(1); 从 “最底层启动”→“系统基础配置”→“硬件驱动”→“中间件能力封装”→“上层业务功能”,分层递进、从基础到应用,就能逐步把整个项目的逻辑串联起来~ 阅读详情

相关推荐

构建面向嵌入式Linux的ARM64交叉编译工具链:从sysroot配置到CMake实战

本文详细介绍了如何构建面向嵌入式Linux的ARM64交叉编译工具链,从sysroot配置到CMake实战。通过分步指导,帮助开发者解决架构不一致问题,提升编译效率,特别适用于树莓派等ARM64设备开发。文章涵盖sysroot机制、环境搭建、CMake配置及常见问题解决方案,是嵌入式开发的实用指南。

weixin_42537142的博客 206

匿名内部类 Anoymous Inner Class, 可以继承抽象类,实现接口

匿名类本身就是通过继承类或者接口来实现的。但是不能再显式的extends 或者implements了。 举个例子: [code="java"] JFrame frame = new JFrame(); [/code] 我们为frame添加窗口事件可以采用如下两种方式: [code="java"] frame.addWindowListener(new WindowLi...

FanfanWing 370

别再傻傻分不清PBR和NPR了!从《原神》到《双城之战》,聊聊游戏里那些让你眼前一亮的渲染风格

本文深入解析了PBR(基于物理的渲染)与NPR(非真实感渲染)在游戏视觉风格中的应用差异,通过《原神》和《双城之战》的案例,展示了两种渲染技术如何创造出截然不同的艺术效果。从技术原理到实战案例,帮助读者理解如何根据项目需求选择合适的渲染风格。

weixin_30425949的博客 152

java 抽象类的匿名类_Java匿名内部类(通过继承抽象类来实现)

3. 匿名内部类没有名字的内部类就是匿名内部类。3.1 匿名内部类特性1. 匿名内部类总是默认实现某个接口或继承某个抽象类。2.不能有构造方法,只能有一个实例。3. 不能定义在任何静态成员、静态方法。4. 不能是public.protected.privatestatic.5. 匿名内部类为局部的,所以局部内部类的所有限制都对其有效。3.2 匿名内部类的使用方式一、继承式的匿名内部类: 就是n...

weixin_42498643的博客 785

安卓7.0+抓包难题:雷电模拟器9.0+Charles系统证书安装全攻略

HTTPS协议通过SSL/TLS加密保障网络通信安全,其核心机制依赖于证书信任链。在Android系统中,自7.0版本起,谷歌收紧了证书信任策略,默认仅信任系统预置的CA证书,这直接导致了传统抓包方法失效。理解这一原理对于移动开发、测试及安全研究至关重要,它揭示了应用层安全策略与系统底层机制的关联。通过将用户证书安装至系统信任区,可以突破此限制,实现HTTPS流量的解密与分析。这一技术在App调试、接口测试、安全审计等场景中具有广泛的应用价值。本文以雷电模拟器9.0和Charles抓包工具为例,详细演示了如

weixin_42521843的博客 284

记录:解决Ubuntu20.04安装ros报错E: Unable to locate package ros-kinetic-desktop-full【亲测有效】

报错:E: Unable to locate package ros-kinetic-desktop-full.尝试好久一直都无法下载,最后得知真相的我眼泪哗哗的直流。

**My Coding Family** 6万+

Java中成员类、嵌套类和匿名类

内部类的注意事项: 1.内部类仅仅是外部类的成员,因此可以被声明为public,private,protected或者是默认值。          外部类只能被声明为public或者是默认值,通常情况下,不会将内部类声明为public,除非真的          找到在外部类之外使用内部类对象的合理原因。 2.内部类可以使用外部类的类和实例变量,以及封闭块的局部变量 3.内部类可以是一个

lzh_86的博客 404

uniapp [安卓苹果App端] - 实现获取手机日历读写权限+调用本机日历数据及操作功能+日历中插入事项事件提醒,检测权限手机日历权限是否开启并引导用户同意授权,uniApp app端开启日历授权

uni-app,权限,手机日历权限,安卓Android,苹果ios,uniapp安卓android获取本机日历读写权限使用,uni-app获取日历权限并实现插入事项事件功能 uniapp苹果IOS系统不支持怎么办,判断权限,权限被拒绝了怎么办,获取日历权限报错,读取日历数据农历阴历并操作插入移除,给用户手机日历中放入一条提示,UniApp调用日历进行读写,打包上架后如何获取,安卓ios权限检测,安卓和ios权限获取,uniapp的APP端日历读写权限与使用示例代码,如何开启日历权限,日历的新增事项和删除,判

🏆 前端领域优质创作者 1万+

注解@Anonymous的用法

通常情况下,Spring Security框架会使用此注解来配置安全性规则,允许一些特定的请求或接口在不需要认证的情况下进行访问。通过使用@Anonymous注解,我们可以轻松地控制哪些接口需要身份验证,哪些接口可以匿名访问,从而实现更细粒度的权限控制。请注意,具体的注解实现可能会因使用的框架或库而有所不同,上述示例仅为演示目的。方法没有被@Anonymous注解标记,表示它需要经过身份验证才能访问,只有已登录的用户才能创建新用户。

zznn0306的博客 6287

【小白CV教程】YOLOv5+Deepsort实现车辆行人的检测、追踪和计数

【小白CV教程】YOLOv5+Deepsort实现车辆行人的检测、追踪和计数本文禁止转载!项目简介:YOLOv5检测器:DeepSort追踪器:运行demo:训练自己的模型:调用接口:创建检测器:调用检测接口: 本文禁止转载! 项目简介: 使用YOLOv5+Deepsort实现车辆行人追踪和计数,代码封装成一个Detector类,更容易嵌入到自己的项目中。 代码地址(欢迎star): https://github.com/Sharpiless/Yolov5-deepsort-inference 最终效果:

梁瑛平的博客 5万+

基于FPGA的NCO实现

NCO实现原理 数字振荡器 输出频率,相位可控的正弦波,精度高,稳定性高,替代VCO,用起来方便也易于操作。 实现方式: 直接调用fpga里面的ip核,以下是IP核的配置方法: 接下来选择输出为单路还是多路: 最后生成ip核时需要注意的事项: 生成时会需要漫长的等待,因此需要如下操作: 最后成功生成: 实现代码: input clk ; input rst_n ; output [13:0]fsin_i ; wire [13:.

m0_46644103的博客 4586

静态嵌套类(Static Nested Class)和内部类(Inner Class)

一. 什么是嵌套类及内部类? 可以在一个类的内部定义另一个类, 这种类称为嵌套类(nested classes),它有两种类型: 静态嵌套类和非静态嵌套类.静态嵌套类使用很少, 最重要的是非静态嵌套类, 也即是被称作为 内部类(inner).嵌套类从JDK1.1开始引入.其中inner类又可分为三种: (1) 在一个类(外部类)中直接定义的内部类; (2) 在一个方法(外部类的方法

machinecat0898的专栏 1万+

数据分享|2023年OSM道路数据(全国,分省,分市)

首先这个工作非常有必要的,因为我们正常使用的道路的分类都是基于包括城市快速路、城市主干路、城市次干路这个体系的,大家对于这个分类体系应该更熟悉,但是OSM地图的道路分类又不是完全按这个来的,所以非常有必要重新分类;搞清楚道路类型是我们使用道路数据做很多工作的基础,比如我们在使用道路数据的时候,经常需要预估道路的行车速度,而这个速度一般就是根据道路类型来的,比如高架路的车速肯定就比城市支路快很多!下载分为两种情况,第一种是下载小区域的数据,比如下载一个街区的数据,第二种为下载整个中国范围的。

JData_Engineer的博客 4312

【转】Static Nested Class 和 Inner Class的不同

Inner Class(内部类)定义在类中的类。 Nested Class(嵌套类)是静态(static)内部类。1. 要创建嵌套类的对象,并不需要其外围类的对象。  2. 不能从嵌套类的对象中访问非静态的外围类对象。 Anonymous Inner Class (匿名内部类)匿名的内部类是没有名字的内部类。 匿名的内部类不能extends(继承)其它类,但一个内部类可以作为一个接口,

hairongtian的专栏 393

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Static Nested Class 和 Inner Class 的不同

Static Nested Class 和 Inner Class 的不同 Static Nested Class(嵌套类)是静态(static)内部类。(一般是C++的说法) Inner Class(内部类)定义在类中的类。 (一般是JAVA的说法) 1.是否能拥有静态成员 静态内部类可以有静态成员(方法,属性),而非静态内部类则不能有静态成员(方法,属性)。 2.访问外部类的成员 ...

PuddingZhan的博客 1928

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

Static Nested Class(嵌套类) 和 Inner Class(内部类)的不同

  ,Static Nested Class(嵌套类) 和 Inner Class(内部类)的不同

DX 2956

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Static Nested Class 和 Inner Class的不同

在Java中,内部类(Inner Class)和静态内部类(Static Nested Class)有一些关键的区别。

zz_ll9023的博客 1044

Inner Class和Static Nested Class的区别?

Inner Class:内部类 内部类就是在一个类的内部定义的类 内部类中不能定义静态成员 内部类可以直接访问外部类中的成员变量 内部类可以定义在外部类的方法外面,也可以定义在外部类的方法体中 在方法体外面定义的内部类的访问类型可以是public,protecte,默认的,private等4种类型 方法内部定义的内部类前面不能有访问类型修饰符,可以使用 final 或 abstract...

ConstXiong 1278

什么是内部类?Static Nested Class 和 Inner Class的不同

内部类就是在一个类的内部定义的类,内部类中不能定义静态成员(静态成员不是对象的特性,只是为了找一个容身之处,所以需要放到一个类中而已,这么一点小事,你还要把它放到类内部的一个类中,过分了啊!提供内部类,不是为让你干这种事情,无聊,不让你干。我想可能是既然静态成员类似c语言的全局变量,而内部类通常是用于创建内部对象用的,所以,把“全局变量”放在内部类中就是毫无意义的事情,既然是毫无意义的事情,就应该被

北京Java青年 2687

Static Nested Class 和 和 Inner Class 的不同

在方法体外面定义的内部类的访问类型可以是 public,protecte,默认的,private 等4种类型, 这就好像类中定义的成员变量有4种访问类型一样,它们决定这个内部类的定义对其他类是 否可见;对于这种情况,我们也可以在外面创建内部类的实例对象,创建内部类的实例对象 时,一定要先创建外部类的实例对象,然后用这个外部类的实例对象去创建内部类的实例对 象,代码如下: Outer ou

htttttt_boss的博客 402

什么是内部类?Static Nested Class 和 Inner Class的不同。

内部类就是在一个类的内部定义的类,内部类中不能定义静态成员(静态成员不是对象的特性,只是为了找一个容身之处,所以需要放到一个类中而已,这么一点小事,你还要把它放到类内部的一个类中,过分了啊!提供内部类,不是为让你干这种事情,无聊,不让你干。我想可能是既然静态成员类似c语言的全局变量,而内部类通常是用于创建内部对象用的,所以,把“全局变量”放在内部类中就是毫无意义的事情,既然是毫无意义的事情,就应该

lixiaoming000的专栏 936

Static Nested Class 和 Inner Class区别

使用Static定义的Class就是外部类,可以通过外部类. 内部类直接访问 而Inner Class是不能被外部访问的,只能通过外部类的实例再找到内部类实例。

ITX2000的专栏 767
上一篇: (转)行为,标准,自勉
下一篇: hibernate 小记
fireq3
博客等级 码龄20年 0粉丝 51原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值