I'm learning Java on my own from a book, and there are times when things are not well explained. I'm trying to understand the concept of return values.
When you have an expression like:
...then SomeFunction returns a value, which is stored in x. When I read about constructors, however, it is always mentioned that constructors have no return value. How is it, then, that expressions such as the following are possible?
or even
If the constructor Change() doesn't return anything, if it has no return value, then how can it be used in expressions?
I know this is a newbie question, but the concept is confusing me. Thanks for any clarification.
When you have an expression like:
Code:
int x = SomeFunction(15);
static int SomeFunction(int number) {
....
}
Code:
Change c = new Change();
Code:
return new Change();
I know this is a newbie question, but the concept is confusing me. Thanks for any clarification.