What does void do in Java?
William Brown
Updated on March 20, 2026
.
Also know, what does a void method do in Java?
void means this method doesn't return a value. Methods can return a single value in Java and it has to be defined in the method declaration. However, you can use return by itself to exit the method.
Secondly, what does Main do in Java? The main() function then calls all the other functions required to run your program. Similarly, in the Java language, when you execute a class with the Java interpreter, the runtime system starts by calling the class's main() method. The main() method then calls all the other methods required to run your application.
Also, what is a public void in Java?
public means that the method is visible and can be called from other objects of other types. This means that you can call a static method without creating an object of the class. void means that the method has no return value. If the method returned an int you would write int instead of void.
Is void a Java type?
void is a type in the Java language (you can read that directly in the Java Language Specification). However the type void has no member values, that is no concrete value will ever have the type void.
Related Question Answers