Steven Hofmann wrote:What am I doing wrong?
Henry Wong wrote:
Steven Hofmann wrote:What am I doing wrong?
Well. if you are trying to code the method to return an array, then you are doing nothing wrong.... However, if you look closely, you declared the method to return a double, not a double array.
Henry
Steven Hofmann wrote:Thanks for the welcome! I wish I could've skipped it, but it was a requirement to return the array for the assignment.
There is no such thing as pass by reference in Java™.Alex Hurtt wrote: . . . passed by reference . . .
Campbell Ritchie wrote:
There is no such thing as pass by reference in Java™.Alex Hurtt wrote: . . . passed by reference . . .
Actually, that is confusing. I meant, that is what would happen if you could use pass-by-reference.I earlier wrote: . . . What you are doing is replacing the actual object with the "rr" in the FooBar class, so it prints "Alex".
That bit is correct. You cannot get "Alex" out of that code, unless you change the JVM to support pass-by-reference.You can try for a thousand years in Java and never get "Alex" printed. What I have shown is what would happen in pass-by-reference. Try it. It will never work. It will always print "Campbell". . . .
| Consider Paul's rocket mass heater. |