Ending a method that has no return type
void setCoefficients(int coef, int power)
The above is just my method header, so the method takes two integer parameters, is performed by an object and has no return type.
What i need to know is - how do i get out of the method early? Say i have 20 lines of code in the method body, but i have modified what i needed to modify after only 10 lines. What lets me end the method after those 10 lines?
Re: Ending a method that has no return type
to get out of a method that has no return type, simply make the call:
Since there is no return type, java will not expect anything to be returned, which makes this a legal statement.
Re: Ending a method that has no return type
Re: Ending a method that has no return type
Actually, according to me void is a no-return datatype. Many people confuse it as it is no datatype.