What is difference between void and return | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between void and return

Give example

26th Nov 2019, 4:44 AM
Rameshwar Shivshette
Rameshwar Shivshette - avatar
3 Answers
+ 6
Review your basic lessons. This is fundamental understanding how methods work in any programming language. https://www.sololearn.com/learn/Java/2153/
26th Nov 2019, 5:05 AM
Tibor Santa
Tibor Santa - avatar
+ 6
Void is a data type whereas return is a statement which allows us to return a value from the function
26th Nov 2019, 5:20 AM
Arsenic
Arsenic - avatar
+ 2
Void is a keyword and also consider as a datatype which return no value in program it on ly print the message while return is a keyword and a statement which specify the value that return by a function
1st Dec 2019, 5:03 PM
suhu
suhu - avatar