The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:ref is always 0. You are incrementing y but using ref for accessing the array.
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:ref is always 0. You are incrementing y but using ref for accessing the array.
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:You are complicating the code.
Also you need to check the values of ref before the start of the loop. Please analyze the code once again and this time use a pen and paper to write down different values of the variables at different point in code.
Executing the program on a machine is not the only way to solve the given problem. Often using paper and pen would give you more understanding than just execution of the code
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohammed Sanaulla was right sayingWe're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
It does no good simply to give such an answer; don't be annoyed with me, but I have removed your answer so as not to deprive naved momin of the chance to learn.. . . I can point out the error but what would you learn from that?
Mohamed Sanaulla wrote:Why can't you do it? Did you follow what I told? I can point out the error but what would you learn from that?
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:Why can't you do it? Did you follow what I told? I can point out the error but what would you learn from that?
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Campbell Ritchie wrote:Jesper, Maneesh, Rob, please don't be annoyed with me for pulling rank.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Mohamed Sanaulla wrote:Instead of ref-- you can get the value from the index array using the "y" as the index (not index array) value.
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/