all answers will be appreciated. 🙂
why do we use void in set method . As I know that it doesn't return any value but clearify this to understand to me please.
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Tata
22 May 2020, 04:15
thank you for reply.
0
Gellert Varga
21 May 2020, 19:15
There are two types of methods:
One is 'void' - they don't send any value back anywhere.
Their job is to do something. Do some calculations, conversions, displaying something, etc.
In set method we don't need any returning data.
It do the setting on the object-variables, and that's all.
The other kind is the "type" method, which returns some type of value. This type must be defined in the method declaration, for example:
This method will return a String type.
Where this data was requested, they will receive it.
If you have any further questions, feel free to ask, via 'Reply' button. +3