In java the word void means it does not return any value, Could anybody explain it to me?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In java the word void means it does not return any value, Could anybody explain it to me??

2nd Apr 2017, 4:56 PM
Jalal Uddin
Jalal Uddin - avatar
4 Answers
+ 20
As long as you put c++ hashtag I'll add this: "Think of void as the "empty structure" http://stackoverflow.com/questions/1043034/what-does-void-mean-in-c-c-and-c
2nd Apr 2017, 5:33 PM
Illusive Man
Illusive Man - avatar
+ 2
yeah it's like void or return 0 in c++
17th Apr 2017, 11:48 AM
Pipe Stark
Pipe Stark - avatar
+ 1
Yes in Java void can not return any value.
2nd Apr 2017, 4:58 PM
Vishal Prajapati
+ 1
If you replace void with int the method returns an int like : public int addition(int a , int b){ return a+b; } Int x = addition( 7,9);
2nd Apr 2017, 5:00 PM
T0nd3