JLS 15.27.1 wrote:
It is a compile-time error if a lambda parameter has the name _ (that is, a single underscore character).
The use of the variable name _ in any context is discouraged. Future versions of the Java programming language may reserve this name as a keyword and/or give it special semantics.
link
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Emmanuel Ekweanua wrote:Also I don't seem to understand the working of the code starting from the for loop, I assume if an increment(or decrement) is not specified, we just run for x=0.Please is my assumption right.
Emmanuel Ekweanua wrote:Thank you Sir for the feedback.
This is what I understand about the for loop. The __A_V_.length is not explicitly stated or _A_V_ length initialized at the start of the code write-up. So I assume it to be 0 (please I am new to programming, my assumption may be wrong).
Emmanuel Ekweanua wrote:
The loop will go through 2 times i.e. 0, 1. This is because of x pre-increment (++x). If it is x++, I will assume the loop will iterate just once, 0.
Emmanuel Ekweanua wrote:$ += __A_V_[x];
For x first iteration, that is, x=0.
We have $ += __A_V_[0];
Emmanuel Ekweanua wrote:I can't still get cmd to compile the file.. I added a snapshot. It said warning but no error. But still it refuse to run.
Emmanuel Ekweanua wrote:
The result was blank.. I could have go further with my reasoning but I want to know why my result is failing to turn up.
Emmanuel Ekweanua wrote:Ok. Just coming to understand __A_V_.length is the array length.
2) If x = 0, what does ++x evaluate to? The x++ equates to 1
3) How many times does the for loop run? Based on the condition, x++<__A_V_.length. It looped just once, because if it did the second time, it will negate the for condition of 1(no of loop)<2(length of array)
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Consider Paul's rocket mass heater. |