this在java中的用法 1.使用this关键字引用成员变量 作用:解决成员变量与参数或局部变量命名冲突的问题 public class Dog { String name; public Dog(String name) { this.name = name; } } 2.使用this关键字引用成员函数.在方法中引用调用该方法的对象 作用:让类中一个方法,访问该类的另一个方法或实例变量 class Dog { public void jump() { System.out.println("…
由PAT1017例题展开: Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow line, until it is his/her turn to be s…