Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 double getarea: double getperimeter; s Which of these classes correctly implements the interface? I. public class square implements TwoDshape int sideLength; public squareint sLen sideLength sLen; public int getarea return sideLength sideLength; public int getperimeter return sidelength; II public class square implements TwoDShape int sideLength; public squareint sLen q sideLength sLen; public double getareaint slen return sLen sLen; public double getperimeter return sideLength; III. public class Square implements TwoDShape int sidelength; public square int sLen sideLength sLen; public double getareaint sLen return sLen sLen; public double getarea return sidelength sidelengthi public double getperimeter return sideLength; A I only B II only C III only D I and II only
Consider the following interface.
public interface TwoDshape
double getarea:
double getperimeter;
s
Which of these classes correctly implements the interface?
I.
public class square implements TwoDshape
int sideLength;
public squareint sLen
sideLength sLen;
public int getarea
return sideLength sideLength;
public int getperimeter
return sidelength;
II
public class square implements TwoDShape
int sideLength;
public squareint sLen
q
sideLength sLen;
public double getareaint slen
return sLen sLen;
public double getperimeter
return sideLength;
III. public class Square implements TwoDShape
int sidelength;
public square int sLen
sideLength sLen;
public double getareaint sLen
return sLen sLen;
public double getarea
return sidelength sidelengthi
public double getperimeter
return sideLength;
A I only
B II only
C III only
D I and II only
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started