Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
Sandra Bachan wrote:
And the following five code fragments:
F1. if(f1 == f2)
F2. if(f1 == f2[2][1])
F3. if(x == f2[0][0])
F4. if(f1 == f2[1,1])
F5. if(f3 == f2[2])
I can understand that F2 and F3 compiles, and that F3 returns true. But why does F5 compile? Isn't f2 a 2-dimensional array?
And what does f2[2] even refer to? I would think the proper way to refer to an element in f2 would be f2[index 1][index 2].
Please clarify
Sandra Bachan wrote:...would be f2[index 1][index 2]
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
Sandra Bachan wrote:So if I understand correctly:
if (2.7f == {2.6f,2.7f})
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
SCJP 6 [SCJP - Old is Gold]
Ram Narayan.M wrote:f2 is a two dimensional array...
f[0],f[1] and f[2] refers to the one-dimensional array of 2 elements...
Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
Sandra Bachan wrote:
OK, this part I understand.
This is really interesting, I never saw anything like this. I don't recall seeing this type of concept in Sierra/Bates, but conceptually, it make sense, because you are comparing 1-d array with 1-d array. I re-wrote the code to output f3 and f2[2], I get memory references
I created code to clear this concept:
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|