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

What is void?

6th Dec 2015, 1:20 AM
JenqAu
JenqAu - avatar
9 Answers
+ 2
void is a return type, if we will declare a method as a void, then that method will not return anything.
16th Dec 2015, 6:46 AM
P Gopalkrishna Patro
P Gopalkrishna Patro - avatar
+ 1
@JenqAU whenever a method is created the method definition must tell the Java program what data the method will send back when it executes successfully (a number, a string, a character, etc). The keyword void is used when a method is designed to not send back any data. It let's the Java program know, "this method does not return any data". The keyword void is not a return type, just information that nothing will be returned. Hope this helps.
1st Mar 2016, 2:17 AM
ItsJustMe
ItsJustMe - avatar
0
it means that the method returns nothing
17th Dec 2015, 6:27 AM
mahmoodreza roodafshani
mahmoodreza roodafshani - avatar
0
it means the method main does not return anything...if you have knowledge of C or C++ then you should know that any method in programming languages have return types which is mentioned before writing the method name...in this case it is void...there are other return types as int , String , char , byte etc
12th Jan 2016, 2:10 PM
Kajal Panigrahi
Kajal Panigrahi - avatar
0
when ever you call a method it goes to that method and executes the code written in it and the executed answer will be returned to method held by the method. So if you declare any methods as VOID then it is not going held the value.Because nothing returns to it.
4th Feb 2016, 12:51 PM
shaik ibrahim
shaik ibrahim - avatar
0
Every method should return something either as integer value or string value or anything else. If we don't want the method to return anything then declare it as 'void'.
1st Mar 2016, 12:29 AM
Devendra Lattu
0
void is a return type which tells that the method returns no value
5th Aug 2016, 11:15 AM
Aditya
Aditya - avatar
0
void is a return type which tells that the method returns no value
5th Aug 2016, 11:16 AM
Aditya
Aditya - avatar
0
void is a keyword in Java which is used to indicate the compiler that the function or method will not be returning any value
17th Nov 2016, 5:00 PM
Prarabdh Garg
Prarabdh Garg - avatar