In C, C++ and Java, Methods, Classes and Functions all share something in common with Variables. It's that they have a Type.
With Methods, Classes and Functions, you have the same Types that you would get for a Variable. That is:
int
double
float
boolean
string
char
These are all the Types you can get with Classes, Methods and Functions. These Types are the same that you use with Variables.
But, the only Type that you don't see being used in Variables and that is:
void
void
is generally a special one. When you create a Class, Method or Function, you specify it's Type. And when you do specify it's Type, it knows to return a value of that Type when it stops running. So, let's say we have a Function.
int Addition()
, in this case.
Addition()
knows that as soon as it's done running it's course and when it's called for, it will return an Integer value.
But, if I declared
Addition()
to be of the Type:
void
, I'm essentially saying: "
When I call for you and/or when you're done running your course, you do not return any value of any Type whatsoever." That's generally how
void
works. It doesn't return anything at all.
Hope this answers your question.