x
Info
x
Warning
x
Danger
 / 
 / 
 / 
   The correct Java syntax for defining defining interface Colorable

Question :    The correct Java syntax for defining defining interface Colorable : 2043798

  1.    The correct Java syntax for defining defining interface Colorable is
    1.                public abstract interface Colorable implements setColor(java.awt.Color c) {}
    2.                public abstract interface Colorable extends setColor(java.awt.Color c) {}
    3.                public interface Colorable {

public void setColor(java.awt.Color c);

}

  1.                public interface Colorable {

public abstract void setColor(java.awt.Color c);

}

  1.    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);

  1.    the one defined in Moveable
  2.    the one defined in Thing
  3.    the one defined in Toy
  4.   the one defined in YoYo
  1.    In what class is the setColor method defined which allows the Ball class to implement the Colorable interface.
    1.    It is defined in Thing and inherited by Ball
    2.    It is defined in Toy and inherited by Ball
    3.    It is defined in Ball
    4.   It is defined in Colorable and inherited by Ball
  2.    The correct Java syntax to declare class Ball given in the UML diagram is:
    1.    public class Ball implements Moveable, Draggable { . . . }
    2.    public class Ball extends Moveable, Draggable implements Toy { . . . }
    3.    public class Ball extend Toy implements Moveable, Draggable { . . . }
    4.   public class Ball implements Toy { . . . }
  3.    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.
    1.    public YoYo ( ) {  this(java.awt.Color.RED);   }
    2.    public YoYo ( ) {  super(java.awt.Color.RED); }
    3.    public YoYo ( ) {  super();  this.setColor(java.awt.Color.RED); }
    4.   none of the above correctly implement the default constructor for YoYo using the default value recipe.

  1.    Syntactically where can an interface name be used.
    1.    only when stating that a class implements the interface
    2.    only as a parameter type in a function
    3.    only as the return type in a function
    4.   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.
  2.    Which of the following would be a good candidate for an interface?
    1.    Modeling that robins, geese, and cardinals are birds
    2.    Modeling that wheels are components of cars, trucks and buses
    3.    Modeling that fish, people and dogs are able to swim
    4.   Modeling that students, administrators, and faculty are all people

  1.    If a class implements two interfaces which specify the exact same method
    1.    An error message occurs
    2.    The method must be defined twice in the class with implements the two interfaces
    3.    This could never happen since a class can only implement one interface
    4.   The method implementation occurs once in the class and that implementation satisfies both interface requirements for that method.
  2.    Which of the following is the recipe to create a component object which needs to know about its container?
    1.    _<part> = new <PartClass> (this);
    2.    _<part> = new <PartClass> (super);
    3.    _<part> = super();
    4.   _<part> = this();

  1. Which of the following is syntactically correct for extending an interface mover with the method setColor(java.awt.Color aColor).
    1.    public interface ColorfulMover implements Mover {

public setColor(java.awt.Color aColor)

}

  1.    public interface ColorfulMover extends Mover {

public setColor(java.awt.Color aColor)

}

  1.    public interface ColorfulMover inherits Mover {

public setColor(java.awt.Color aColor)

}

  1.   public interface ColorfulMover implements Mover,

public setColor(java.awt.Color aColor) {  }

Solution
5 (1 Ratings )

Solved
Computer Science 2 Years Ago 154 Views
This Question has Been Answered!
Unlimited Access Free
Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Instant Access!
Ask an Expert
Our Experts can answer your tough homework and study questions
154368 Computer Science Questions Answered!
Post a Question