this关键字-JAVA基础知识学习
- this关键字指向当前类或对象
- 在Student类的setName方法中,this.name = name,把参数name赋值给当前对象的name属性
- 在Student类的getName方法中,return name,返回当前对象的name属性值
- this关键字的使用可以简化代码,提高可读性
1.87MB
文件大小:
评论区