Question :
The correct Java syntax for defining defining interface Colorable : 2043798
-
The correct Java syntax for defining defining interface Colorable is
- public abstract interface Colorable implements setColor(java.awt.Color c) {}
- public abstract interface Colorable extends setColor(java.awt.Color c) {}
- public interface Colorable {
public void setColor(java.awt.Color c);
}
- public interface Colorable {
public abstract void setColor(java.awt.Color c);
}
- Given that myYoYo is declared and instantiated with the statement:
YoYo myYoYo = new YoYo(); which definition of move would be used by the statement myYoYo.move(10, 5);
- the one defined in Moveable
- the one defined in Thing
- the one defined in Toy
- the one defined in YoYo
-
In what class is the setColor method defined which allows the Ball class to implement the Colorable interface.
- It is defined in Thing and inherited by Ball
- It is defined in Toy and inherited by Ball
- It is defined in Ball
- It is defined in Colorable and inherited by Ball
-
The correct Java syntax to declare class Ball given in the UML diagram is:
- public class Ball implements Moveable, Draggable { . . . }
- public class Ball extends Moveable, Draggable implements Toy { . . . }
- public class Ball extend Toy implements Moveable, Draggable { . . . }
- public class Ball implements Toy { . . . }
-
Given that the default color for a YoYo is RED and using the default value recipe, which of the following correctly implements the default constructor for YoYo.
- public YoYo ( ) { this(java.awt.Color.RED); }
- public YoYo ( ) { super(java.awt.Color.RED); }
- public YoYo ( ) { super(); this.setColor(java.awt.Color.RED); }
- none of the above correctly implement the default constructor for YoYo using the default value recipe.
-
Syntactically where can an interface name be used.
- only when stating that a class implements the interface
- only as a parameter type in a function
- only as the return type in a function
- anywhere a class name can be used, except in an initialization statement after the keyword new and in stating that a class implements the interface.
-
Which of the following would be a good candidate for an interface?
- Modeling that robins, geese, and cardinals are birds
- Modeling that wheels are components of cars, trucks and buses
- Modeling that fish, people and dogs are able to swim
- Modeling that students, administrators, and faculty are all people
-
If a class implements two interfaces which specify the exact same method
- An error message occurs
- The method must be defined twice in the class with implements the two interfaces
- This could never happen since a class can only implement one interface
- The method implementation occurs once in the class and that implementation satisfies both interface requirements for that method.
-
Which of the following is the recipe to create a component object which needs to know about its container?
- _<part> = new <PartClass> (this);
- _<part> = new <PartClass> (super);
- _<part> = super();
- _<part> = this();
-
Which of the following is syntactically correct for extending an interface mover with the method setColor(java.awt.Color aColor).
- public interface ColorfulMover implements Mover {
public setColor(java.awt.Color aColor)
}
- public interface ColorfulMover extends Mover {
public setColor(java.awt.Color aColor)
}
- public interface ColorfulMover inherits Mover {
public setColor(java.awt.Color aColor)
}
- public interface ColorfulMover implements Mover,
public setColor(java.awt.Color aColor) { }
Solution
5 (1 Ratings )
Related Answers