Dieses Schlüsselwort in Java
/**
* This keyword,
* this keyword is a reference variable that refers to the current class
* instance.
*/
class Student {
int id;
String name;
Student(int id, String name) {
this.id = id;
this.name = name;
}
void display() {
System.out.println(this.id);// both way can call
System.out.println(this.name);
System.out.println(id);
System.out.println(name);
}
}
public class This {
public static void main(String[] args) {
Student student = new Student(10, "Mike");
student.display();
}
}
Rajput