What is not the use of this keyword in Java? code example
Example 1: this obj java meaning
public class Point {
public int x = 0;
public int y = 0;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
Example 2: how to use the this keyword in java
class Other{
public double num;
public Other(int num){
this.num = num;
System.out.println(num);
}
}
class scratch{
public static void main(String[] args) {
Other method = new Other(5);
System.out.println(method.num);
}
}
Example 3: this obj java meaning
public class Point {
public int x = 0;
public int y = 0;
public Point(int a, int b) {
x = a;
y = b;
}
}