Ana sayfa
/
Teknoloji
/
TopHat Question Which color-code I segment of this program is incorrect? A. public interface Colorable [ public Color getColor('it B. return Color.PINK; C. public class Rectangle implements colorable i constructor elided D. ooverride public Color getColor() E. return Color.RFD; Join Code: 316

Soru

TopHat Question
Which color-code I segment of this program is incorrect?
A. public interface Colorable [
public Color getColor('it
B.	return Color.PINK;
C. public class Rectangle implements colorable i
constructor elided
D. ooverride
public Color getColor()
E.	return Color.RFD;
Join Code: 316

TopHat Question Which color-code I segment of this program is incorrect? A. public interface Colorable [ public Color getColor('it B. return Color.PINK; C. public class Rectangle implements colorable i constructor elided D. ooverride public Color getColor() E. return Color.RFD; Join Code: 316

Çözüm

4.5150 Voting
avatar
Nurettin
Gelişmiş · 1 yıl öğretmeni
Uzman doğrulaması

Cevap

The incorrect color-code I segment of this program is:<br /><br />C. public class Rectangle implements Colorable {<br />constructor elided<br />}<br /><br />The correct implementation should be:<br /><br />public class Rectangle implements Colorable {<br /> private Color color;<br /><br /> public Rectangle() {<br /> this.color = Color.PINK;<br /> }<br /><br /> @Override<br /> public Color getColor() {<br /> return this.color;<br /> }<br />}
Derecelendirmek için tıklayın: