Question: Identify the object - oriented principle violated in this code. public class Square { private double side; public Square ( double side ) { this.

Identify the object-oriented principle violated in this code.
public class Square {
private double side;
public Square(double side){
this. side = side;
}
public double calculateArea(){
return side ?** side;
}
public String getColor(){
return "Red";
}
}
a. Code to an interface rather than to an implementation.
b. Each class in your application should have only one reason to change.
c. Classes are about behavior and functionality.
d. Encapsulate what varies.
e. None
 Identify the object-oriented principle violated in this code. public class Square

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!