Question: 1.Fix the issues that are preventing the code from compiling(JAVA 1.8). /* * The square class models a square with a length and color. */

1.Fix the issues that are preventing the code from compiling(JAVA 1.8). /* * The square class models a square with a length and color. */ public class Square { // Save as "Square.java" // private instance variable, not accessible from outside this class private double length; private String color; // The default constructor with no argument. // It sets the length and color to their default value. public square() { length = 1.0; color = "red"; // 2nd constructor with given length, but color default public square(double r) { length = r; color = "red" } // A public method for retrieving the length public double getlength() { return length; } // A public method for computing the area of square public double getArea() { return length*length; } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!