Question: Consider the following interface. public interface TwoDshape 1 double getarea ( ) : double getperimeter ( ) ; s Which of these classes correctly implements

Consider the following interface.
public interface TwoDshape
1
double getarea():
double getperimeter();
s
Which of these classes correctly implements the interface?
I.
public class square implements TwoDshape
{
int sideLength;
public square(int sLen)
}
sideLength = sLen;
}
public int getarea()
{ return sideLength * sideLength; }
public int getperimeter()
}
{ return 4* sidelength; }
II.
public class square implements TwoDShape
1
int sideLength;
public square(int sLen)
q
sideLength = sLen;
}
public double getarea(int slen)
{ return sLen * sLen; }
public double getperimeter()
}
{ return 4* sideLength; }
III. public class Square implements TwoDShape
1
int sidelength;
public square (int sLen)
1
sideLength = sLen;
}
public double getarea(int sLen)
return sLen * sLen; }
public double getarea()
return sidelength * sidelengthi }
public double getperimeter()
}
{ return 4** sideLength; }
(A) I only
(B) II only
(C) III only
(D) I and II only
 Consider the following interface. public interface TwoDshape 1 double getarea(): double

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!