I have a Fraction class using keyword this in my constructor:
public Fraction(int numerator, int denominator)
{
this.numerator = numerator;
this.
I think you have a bit of a confusion on how the "this" keyword works.
Let me give you an example:
This
public class testing {
private int a;
private int b;
testing(int a,int b){
this.a = a;
this.b = b;
}
}
is the same as:
public class testing {
private int a;
private int b;
testing(int x,int y){
this.a = x;
this.b = y;
}
}
Which of course for the second one would be easier to put if we do it like this:
public class testing {
private int a;
private int b;
testing(int x,int y){
a = x;
b = y;
}
}