aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes sierra/bates   ch.4 self test, question #2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "sierra/bates   ch.4 self test, question #2" Watch "sierra/bates   ch.4 self test, question #2" New topic
Author

sierra/bates ch.4 self test, question #2

Rachel Glenn
Ranch Hand

Joined: Oct 24, 2012
Posts: 95
given the code segment:



and the test for equality...




Is the reason the equality test COMPILES because f3 and f2[2] are considered object references? I initially thought this might not compile because the array sizes were different.
Enkita mody
Ranch Hand

Joined: Aug 06, 2012
Posts: 333

R Gle wrote:given the code segment:



and the test for equality...




Is the reason the equality test COMPILES because f3 and f2[2] are considered object references? I initially thought this might not compile because the array sizes were different.


Yes.You're comparing their address not any element.


-hth


OCA7
Praveen Kumar M K
Ranch Hand

Joined: Jul 03, 2011
Posts: 256
R Gle wrote:given the code segment:



and the test for equality...




Is the reason the equality test COMPILES because f3 and f2[2] are considered object references? I initially thought this might not compile because the array sizes were different.


f2 is an array of arrays, therefore the individual elements within this collection should also be arrays, correct? So when you access f[2] you are accessing an array at the 2nd position, so it should compile.
How about trying if(f2 == f3) {}?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sierra/bates ch.4 self test, question #2