Question: Consider the code: public class A { public int compute ( int x ) { if ( x < 0 ) return 0 ; return

Consider the code:
public class A {
public int compute(int x){
if (x <0)
return 0;
return x +1;
}
}
public class B extends A {
@Override
public int compute(int x){
return (x+1);
}
}
Which of the following is true:
a.
This code does not violate any of SOLID principles
b.
This code violates single responsibility principle
c.
This code violates open-close principle
d.
This code violates Liskov substitution principle
e.
This code violates interface segregation principle
f.
This code violates dependency inversion principle

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!