Question: Explain the difference between an is - a and has - a relationship in Java. public class Example { public static void
Explain the difference between an isa and "hasa relationship in Java.
public class Example public static void mainString args double a ; double b; double total calcb a; System.out.printlnthe total is total; public static double calcdouble c double d return c d;
What are the names of the formal parameters for method calc in the above class?
Do you find actual parameters in the method definition or method invocation?
What is the method signature of method calc?
What is the method header of method calc?
Is the static keyword required here in the declaration of the calc method? Why or why not?
Provide an example of each concept to further demonstrate your understanding. no code is required for this question, but feel free to use code if it helps your explanation
Answer text Question
Rich text editor
Question Answer
a
private methods
b
public methods
c
protected methods
d
a and b
e
b and c
Question Answer
a
the parameter list and method name
b
the parameter list
c
the method name
d
return type, method name, and parameter list
Question Answer
a
x contains a reference to a Circle object.
b
x contains an object of the Circle type.
c
You can assign an int value to x
d
x contains an int value.
Question Answer
a
that a variable of supertype can refer to a subtype object
b
none of the above
c
that a class can contain another class
d
that data fields should be declared private
Question Answer
a
Raptor object can refer to a Lightning object
b
FighterJet object can not refer to a Lightning object
c
Lightning object can refer to a Raptor object
d
FighterJet object can refer to a Raptor object
Question Answer
a
Subclass is more detailed than the superclass
b
Superclass is more detailed than the subclass
c
Subclass and superclass are only related through composition
d
Both the subclass and superclass have the same level of detail
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
