多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## [this 关键字](https://snailclimb.gitee.io/javaguide/#/docs/java/basic/final,static,this,super?id=this-%e5%85%b3%e9%94%ae%e5%ad%97) **this关键字用于引用类的当前实例**。 例如: ~~~ class Manager { Employees[] employees; void manageEmployees() { int totalEmp = this.employees.length; System.out.println("Total employees: " + totalEmp); this.report(); } void report() { } } ~~~ 在上面的示例中,this关键字用于两个地方: * this.employees.length:访问类Manager的当前实例的变量。 * this.report():调用类Manager的当前实例的方法。 此关键字是可选的,这意味着如果上面的示例在不使用此关键字的情况下表现相同。 但是,使用此关键字可能会使代码更易读或易懂。