Consider the following code snippet: public class Inventory implements Measurable
{
) . .
Double getMeasure();
{
Return onHandCount;
}
}
The compiler complains that the getMeasure method has a weaker access level than the Measurable interface. Why?
Consider the following code snippet. public interface Measurable
{
Double getMeasure();
}
Public class Coin implements Measurable
{
Public double getMeasure()
{
Return value;
}
)..
}
Public class DataSet
{
)..
Public void add()
{
)..
}
}
Public class BankAccount
{
)..
Public void add()
{
)..
}
}
Which of the following statements is correct?
Consider the following code snippet: public class Inventory implements Measurable
{
) . .
Double getMeasure();
{
Return onHandCount;
}
}
What is wrong with this code?
Consider the following code snippet: public class Inventory implements Measurable
{
) . .
Public double getMeasure();
{
Return onHandCount;
}
}
Why is it necessary to declare getMeasure as public ?
Consider the following declarations: public interface Encryptable
{
Void encrypt(String key);
}
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?
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?
Consider the following code snippet: public interface Sizable
{
Int LARGE_CHANGE = 100;
Int SMALL_CHANGE = 20;
Void changeSize();
}
Which of the following statements is true?