this关键字
来源:互联网 发布:数据挖掘学习 编辑:程序博客网 时间:2024/06/16 05:38
this关键字作用:
(1)调用类中的属性;
(2)表示当前类
(3)调用构造方法或当前类中的方法
示例如下:
public class People {
//构造方法
public People(){
this("调用构造方法");
//表示当前类,调用类中的方法
this.getName();
}
public People(String name){
this.name=name;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
//表示当前类调用类中的属性
this.name = name;
}
}
0 0
- 关键字this
- this关键字
- this关键字
- this 关键字
- this 关键字
- this关键字
- this关键字
- this 关键字
- this 关键字
- this 关键字
- this关键字
- 关键字this
- 关键字this
- this 关键字
- this 关键字
- this关键字
- this关键字
- This关键字
- BIOS工程师手边事-题前话
- 1102 采药
- ORM概况了解
- List,Set,Map是否继承自Collection接口?
- kafka in a nutshell -- kafka 简介
- this关键字
- 试写一篇
- javabean 规范里 boolean 属性的 getter 可以写成 isXXX ,可是这样的 getter 不方便使用。
- ThreadPoolExecutor几点使用建议
- 测试图片
- HTML DOCTYPE 标签
- 图像滤镜艺术---图像滤镜晕影调节算法研究
- static的理解
- 如何在Mac上安装IntelliJ IDEA