Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are creating a class which is supposed to use an interface named Measurable.

ID: 3807613 • Letter: Y

Question

You are creating a class which is supposed to use an interface named Measurable. Which of: the following class declaration statements will accomplish this? a. public class vessel extends Measurable b. public class vessel interfaces Measurable c. public class vessel implements Measurable d. public class vessel inherits Measurable Refer to the following interface and classes. interface sample {public void someMethod ();} class sampleA implements sample {public void someMethod () {System. out. printIn ("Test in A");}} class sampleB implements sample {public void someMethod () {System. out.println ("Test in B");}} Which of the following declarations are legal? I. Sample A a = new SampleB (); II. Sample s1 = new SampleA (); III. Sample s2 = new Sample (); a. I and II only b. III only c. II and III only d. I only e. II only Which of the following statements about an interface is true? a. An interface can only have instance variables that are public. b. An interface can only have instance variables that are private. c. An interface can only have methods that are private. d. An interface can only have a default (no parameter) constructor. e. An interface can only have methods that are public.

Explanation / Answer

Question 12:

Answer: C

we can inherit the interfaces by using the keyword "implements"

we can inherit the classes by using the keyword "extends"

Question 13:

Answer: E

We can create an instance of child that is assigned to parent class.

In our case, Sample is a parent class so we can assign a child class instance to parent.

Sample s = new SampleA();

Sample s = new SampleB();

Above three statements are legal to use.

Question 14:

Answer: A and E

An interface can have instance variables and abstract methods that should be a public type.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote