Soru
given the following menace. public interface clickable 1 public void click(); Which of the following would work as an imp lementation of the clickable interface? (don't worry about what changexPosition does) A. @override C. public double click() return this.changexposition(10a.8); @override public void clickit() ( this.changexposition(188.8); 1 B. @override D. @override public void click() ( this.changexposition(100.e); public vold click(double xPosition) this.change)Position(x osition);
Çözüm
4.0196 Voting
Asena
Usta · 5 yıl öğretmeniUzman doğrulaması
Cevap
The correct answer is A.<br /><br />Option A correctly implements the `click()` methodClickableView` interface. The `@override` annotation indicates that the method is intentionally overriding a method from a parent class, and the method signature matches the one specified in the interface. The method simply calls the `changeXPosition()` method with the argument `10.8`, which is allowed as the method can take any argument.<br /><br />Option B is incorrect because the method name `clickit()` does not match the method name specified in the interface, which is `click()`.<br /><br />Option C is incorrect because the method `click()` returns a `double` value, but the interface method `click()` does not specify a return type.<br /><br />Option D is incorrect because the method `click()` takes a `double` argument `xPosition`, but the interface method `click()` does not specify any arguments.
Derecelendirmek için tıklayın: