Whats the difference between
public void Sum()
and
public int Sum()
I tried searching on Google/YouTube and I’ve learned that public int Sum() needs a return statement. I’m using return a lot, but I really dont know what is the use of it on methods.
public void sum()doesn’t return any value e.g. below:public int sum()must return a value of typeinte,g, below: