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

10. Suppose you are writing an interface called Resizable, which includes one vo

ID: 3812519 • Letter: 1

Question

10. Suppose you are writing an interface called Resizable, which includes one void method called resize. public interface Resizable Which of the following can be used to complete the interface declaration correctly? a private void resize b protected void resize C) void resize d public void resize System. out.println ("resizing 11. Consider the following declarations: public interface Encryptable void encrypt (String ke y) public class SecretText implements Encryptable private String text; code to encrypt the text using encryption key goes here Which of the following method headers should be used to complete the SecretText class a public void encrypt b public void encrypt (string akey) c public string encrypt (string akey) d) void encrypt (string akey)

Explanation / Answer

Q10)

Answer : c) void resize();

Since a method in interface can't be private and protected . They can be public but cannot define it's body unless it is a static method.

Q11)

Answer: b) public void encrypt (String akey);

Q12)

Answer : option a)

Since dataset class and BankAccount class neither implements Measurable and nor they have any relation with class coin .

Q13)

Answer : I don't think any of the answers are correct . The example shows the implementation of late binding or dynamic binding because the call to toString() method cannot be determined before runtime.

Q14)

Answer : option c)

Since the interface Displayable has only display() as its member.

Q15)

Answer : option c) player otherPlayer = (Player) otherObject;

First of all Object class is parent of all classes.

We cannot fetch goalsScored member using Object class instance because it doesn't have any such member. Now when we assign a class to another class we have to make an explicit type casting . Only option c) satisfies all conditions.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote