Question: 26) What is the error in the following code? public inteface Myinterface { int myNum =55; public int methodA(double); } public class MyClass implements MyInterface
26) What is the error in the following code?
public inteface Myinterface
{
int myNum =55;
public int methodA(double);
}
public class MyClass implements MyInterface
{
int myNum2 = 60;
public int methodB(double);
{
}
}
A) it does not override methodA
B) interfaces can not have attributes
C) It does not overload methodA
D) It does not have a constructor
21) The Attributes for this Person class are encapsulated. Write the method header (just one line) for the "getter" for the class shown below that would allow any other class to get the value of the address for a Person object.
public class Person
{
private String name: //The persons name
private String address; //The presons address
private String phone; // The persons phone number
16) Suppose we create a subclass from a class that has a method called someMethod then we override someMethod in the subclass. Write one line of code that shows how it is possible to access the superclass's version of someMethod
9) Consider a software system that will implement the following classes: SavingsAccount, CheckingAccount, RetirementAccount. List three candidates for common attributes of these classes. What would be a good abstract class from which these classes may be extended via inheritance?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
