Question: #1 Given the following code: public class Money { public int dollars; public int cents; public boolean equals(Money anotherAmount) { return ((dollars == anotherAmount.dollars) &&
#1
Given the following code:
public class Money { public int dollars; public int cents; public boolean equals(Money anotherAmount) { return ((dollars == anotherAmount.dollars) && (cents == anotherAmount.cents)); } } public class MoneyDemo { public static void main(String[] args) { Money amount1 = new Money(); Money amount2 = new Money(); amount1.dollars = 4; amount1.cents = 50; amount2.dollars = 4; amount2.cents = 50; System.out.println(amount1.equals(amount2)); } } Identify the following (provide exact names/words, and you only have to identify one even if there might be more):
A Class:
A Method:
A Method Return Type:
An Instance Variable:
A Parameter:
An Argument:
An Object:
#2
Match the definition or statement with the correct word or phrase.
instance of the class
parameters instance variables declaring arguments class new operator object method
data items of an object declared in the class that contain values unique to each object
parameters instance variables declaring arguments class new operator object method
a type
parameters instance variables declaring arguments class new operator object method
used to create an object
parameters instance variables declaring arguments class new operator object method
contained within the parentheses of a method heading
parameters instance variables declaring arguments class new operator object method
values that are within the parentheses of a method when the method is invoked
parameters instance variables declaring arguments class new operator object method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
