What are the two ways can we compare for equality?
a. operator -> _______
b. method -> ________ - ANSWER a. ==
b. equals
I want to compare to primitives, what do I use?
a. ==
b. equals
c. compareto() - ANSWER a
I want to compare to strings, what do I use?
a. ==
b. equals
c. compareto() - ANSWER b
I want to compare two objects to see if they are at the same address,
what do I use?
a. ==
b. equals
c. compareto() - ANSWER a
I want to compare the contents of two objects to see if they are equal,
what do I use?
a. ==
b. equals
c. compareto() - ANSWER b
, If you have two custom classes that you create, you need to code a
custom equals method for comparing the contents of objects.
a. true
b. false - ANSWER a
All parameters in JAVA are passed by value.
a. true
b. false - ANSWER a
You call a method with a string, what is passed to the method?
a. The letters in the string object.
b. A copy of the string object.
c. A copy of the pointer to the string object. - ANSWER c
A pointer to an object should never be returned from a method.
a. true
b. false - ANSWER b
When passing an array to a method, a copy of the array is made.
a. true
b. false - ANSWER b
What is the term used for making another pointer on a reference object?
- ANSWER casting
What syntax is used to accomplish casting?
a. &
b. super
c. ( )
d. base - ANSWER c
One can always up cast into type Object if needed in any object.
a. operator -> _______
b. method -> ________ - ANSWER a. ==
b. equals
I want to compare to primitives, what do I use?
a. ==
b. equals
c. compareto() - ANSWER a
I want to compare to strings, what do I use?
a. ==
b. equals
c. compareto() - ANSWER b
I want to compare two objects to see if they are at the same address,
what do I use?
a. ==
b. equals
c. compareto() - ANSWER a
I want to compare the contents of two objects to see if they are equal,
what do I use?
a. ==
b. equals
c. compareto() - ANSWER b
, If you have two custom classes that you create, you need to code a
custom equals method for comparing the contents of objects.
a. true
b. false - ANSWER a
All parameters in JAVA are passed by value.
a. true
b. false - ANSWER a
You call a method with a string, what is passed to the method?
a. The letters in the string object.
b. A copy of the string object.
c. A copy of the pointer to the string object. - ANSWER c
A pointer to an object should never be returned from a method.
a. true
b. false - ANSWER b
When passing an array to a method, a copy of the array is made.
a. true
b. false - ANSWER b
What is the term used for making another pointer on a reference object?
- ANSWER casting
What syntax is used to accomplish casting?
a. &
b. super
c. ( )
d. base - ANSWER c
One can always up cast into type Object if needed in any object.