Java question Having trouble implementing a method that takes a parameter and returns the sum of the current object and parameter. How do I do this?
public int addParameter( int x ) { return( this.objectsValue + x ); }
how would I apply this to a method that takes in a complexnumber and returns a current object plus the parameter.
the sum of the current object and parameter equals the complex number
can u send me a resource online on this
I'm sorry, I don't know complex numbers from my elbow. It's doubtful that the entire object is a value. The reason I say that is that objects are usually made of parameters and methods, so I expect that IN the object is the value that will be added to the parameter. Quite possibly, this is done by one, or several (overloaded), of the object's methods.
Join our real-time social learning platform and learn together with your friends!