| Author |
The dot(.) operator and [] operator
|
Kim Lauwers
Ranch Hand
Joined: Sep 23, 2005
Posts: 31
|
|
Hello everyone, Is there a site or something witch explanes me these two operators because I find them rather difficult. Or if someone can explain me this shortly. I'm using HFSJ for studying. thx
|
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots.<br />So far, the Universe is winning!
|
 |
Kim Lauwers
Ranch Hand
Joined: Sep 23, 2005
Posts: 31
|
|
Little question about it. When a have a map: java.util.Map someMap = new java.util.HashMap(); someMap.put("key","value"); someMap["key"] -->will return value? map[key]--> wil return null? correct?
|
 |
Balasubramani Dharmalingam
Ranch Hand
Joined: Dec 06, 2004
Posts: 116
|
|
${someMap["key"]} In this case it will return the object from someMap that mapped to string "key" will be return. ${someMap[key]} In this case the value for the key ( equivalent to ${key} ) is evaluated then the object mapped for that value will be return.
|
Balasubramani SD,<br />SCJP 1.4,SCWCD 1.4,SCJP 5.0<br /><a href="http://sd.balasubramani.googlepages.com" target="_blank" rel="nofollow">www.sd.balasubramani.googlepages.com</a>
|
 |
Richard Green
Ranch Hand
Joined: Aug 25, 2005
Posts: 536
|
|
java.util.Map someMap = new java.util.HashMap(); someMap.put("key","value"); someMap["key"] --> request.getAttribute(someMap.get("key")) --> value someMap[key]--> request.getAttribute(someMap.get(request.getAttribute("key")) --> null
|
MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
|
 |
 |
|
|
subject: The dot(.) operator and [] operator
|
|
|