Java 类.this含义与.new
来源:互联网 发布:智能排班软件app 编辑:程序博客网 时间:2024/06/07 14:14
类.this用在内部类中
用于获取外部类对象的引用
public class JavaTest {
public static void main(String[] args) {
JavaTest t=new JavaTest();
A a=t.new A();
a.run();
System.out.println(t);
}
public void run(){
System.out.println("JavaTest");
System.out.println(this);
System.out.println(JavaTest.this);
}
class A{
public void run(){
JavaTest.this.run();
System.out.println(JavaTest.this);
System.out.println("A");
}
}
}
输出结果:
JavaTest
com.yihaodian.search.nlp.JavaTest@c17164
com.yihaodian.search.nlp.JavaTest@c17164
com.yihaodian.search.nlp.JavaTest@c17164
A
com.yihaodian.search.nlp.JavaTest@c17164
外部类对象.new,创建内部类对象
0 0
- Java 类.this含义与.new
- this、new与对象
- java中this的含义?
- Java synchronized (this) 的含义
- JavaScript中new与this
- javascript this指代,new的含义以及prototype,原型链
- 【java】类与对象-this
- java中this的含义和用法
- JS this 与new 及原型链
- java炒冷饭系列10 内部类 使用.this与.new和向上转型
- java 类与对象 2---this关键字
- JAVA.Study.Note.JAVA中this.<***>的含义
- C++的new与JAVA的new
- 关于java与Android(安卓)中为什么要在new一个对象的后面加一个this的原因
- Java环境变量配置与含义
- 理解Java中this和static的含义
- java中this$0的含义及用法
- java笔记 this关键字的含义和用处
- twemproxy redis ttserver phpadmin memcache
- ACRush 楼天成回忆录 (与所有ACMer共勉!!)
- 参加了华为奖学金答辩,哎。。。太紧张了,估计没多少希望了
- 怎样为内核打补丁
- C++状态模式的用法
- Java 类.this含义与.new
- DB2统计表和索引占用空间量
- 【Android】SpinnerWheel开源项目
- ubuntu开启SSH服务,并允许ROOT权限远程登录。
- Codeforces Round #283 (Div. 2) D. Tennis Game
- centos安装mysql,tomcat,jdk
- 安全卫士——Day04_2
- vc6中 EnumDisplayDevices 判断扩展屏幕,以及取得扩展屏幕的示例代码。
- 只有随遇而安,才能随心所欲。这是最好的人生状态