Question: A part of the LineSI class from Section 5.6.1 is shown below. Identify necessary and unnecessary use of the keyword this. public class LineSI {
A part of the LineSI class from Section 5.6.1 is shown below. Identify necessary and unnecessary use of the keyword this.

public class LineSI { // data members private static final double DEFAULT_VALUE private double slope; private double intercept; // methods public void setSlope (double slope) { this.slope = slope; } public void setIntercept (double intercept) { this.intercept = intercept; } = 0.0; public void set Intercept (double intercept) { this.intercept = intercept; } public void setLine (double slope, double intercept) { // using set Slope and setIntercept methods this.setSlope (this.slope); this.setIntercept (this.intercept); } public void setLine (PointD pt1, PointD pt2) { // using first setLine method this.setLine ((pt2.getY ()-pt1.getY ()) / (pt2.getX ()-pt1.getX () ), ((pt2.getX() *pt1.getY()) (pt1.getX() *pt2.getY()))/(pt2.getX()-pt1.getX()));
Step by Step Solution
3.46 Rating (162 Votes )
There are 3 Steps involved in it
In the Java programming language the this keyword is used within an instance method or a constructor to refer to the current objectthe object whose me... View full answer
Get step-by-step solutions from verified subject matter experts
