Forums Register Login

The dot(.) operator and [] operator

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
${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.
+Pie Number of slices to send: Send
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
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 593 times.
Similar Threads
++ operator
'+' operator overloading in java
| operator
operators
Operators
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:12:32.