Can someone explain what this part:Code:Here's a simple example: class Bird { int xPos, yPos; double fly ( int x, int y ) { double distance = Math.sqrt( x*x + y*y ); flap( distance ); xPos = x; yPos = y; return distance; } ... }
flap( distance );
does, or what is happening with it? How is it being used? Is it a method inside the fly method?
Also:
How is the return statement working here?Code:class Bird { int xPos, yPos; int xNest, yNest; ... double flyToNest( ) { int xPos = xNest; int yPos = yNest: return ( fly( xPos, yPos ) ); } ... }
return ( fly( xPos, yPos ) );
I know these are examples, but they are confusing me as it seems they are leaving things out. Whats being left out?
Thanks in advance for clearing it up.




Reply With Quote