About methods | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About methods

guys. in which cases do we put void and data types in methods

29th Mar 2017, 8:47 AM
Legend Shees
Legend Shees - avatar
3 Answers
0
Put void if you don't want the method to return a value. This is equivalent to a procedure. Put a data type if you want to return a value. This is equivalent to a function.
29th Mar 2017, 8:56 AM
Hassie
Hassie - avatar
0
If your method does not must return anything, you put void types in method, but if your method must return some value - you put data types(int, String...)
29th Mar 2017, 8:58 AM
Jesus Raychuk
Jesus Raychuk - avatar
0
@JesusRaychuk your answer was helpful .. I'm thankful
29th Mar 2017, 9:00 AM
Legend Shees
Legend Shees - avatar