answersLogoWhite

0

What does a void method do?

Updated: 8/11/2023
User Avatar

Wiki User

11y ago

Best Answer

In Java, this keyword is used to specify that the method has no return value.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

A function that has no return value.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does a void method do?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Do void methods have parameters?

A void method is just like any other method; it may or may not have parameters.


What is the difference of non void and void function?

If a method call is void, that means it will not return a data value to a program that calls it. Otherwise, the method is expected to return a data value of some sort. For example, if I have a method called print() that is void, and the body of the method has a command to print a word to the screen, the method will run that command and end. However, if I have a method called add(int x, int y) that takes two numbers and adds them together, the program calling this method wants an answer back. So this method is not void.


Void in java?

Void is a keyword in Java. It is always used in method declarations. When used in the line that declares a method, it signifies the fact that the method will not return any value. The JVM will not expect the method to return anything. Ex: public static void main(String[] args) {}


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.


What does the word part void mean?

void basically signifies that the method will not have a return value.


What is polymorphism in programming?

Polymorphism is the method in which a java program can have more than one function(or method) with the same name but different method signatures(different parameters or return type). possible allowance: void s() void s(int a) void s(int a,int b) void s(float a) int s()


Why do you write void to the first of main?

Because main is the first method being executed, the Java Virtual Machine cannot expect any return values from this method. Since void is the term used to refer to a variable that does not return any value, we use the key word void for the method signature of the main method


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


The keyword indicates that a method does not return a value?

void


Is 'void' a data type in java?

No. The void keyword is used to signify that a method will not return any objects. For example, if you type in "double", you'll need a return statement that has a double. So "void" means that there will be nothing returned.


What comes immediately before the method name in a declaration?

The return type of a method, if the method returns nothing then use 'void'


Can an overridden method return void instead of an object?

Sure. An overridden method can return anything it wants.