answersLogoWhite

0

Void in java

Updated: 12/14/2022
User Avatar

Wiki User

12y ago

Best Answer

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) {}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Void in java
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is psvm in java?

public static void main


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.


What are the seven abstract method of window listener in java?

# void windowActivated(WindowEvent e); # void windowClosed(WindowEvent e); # void windowClosing(WindowEvent e); # void windowDeactivated(WindowEvent e); # void windowDeiconified(WindowEvent e); # void windowIconified(WindowEvent e); # void windowOpened(WindowEvent e);


What is the error in exception handling in java with example?

class Demo { public static void main(String s[]) { System.out.println("hello java frm Demo"); } } class Demo1 { public static void main(String s[]) { System.out.println("hello java frm Demo1"); String z={" "}; Demo.main(); } }


What is the Java Script code to hack power school?

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0


What is the purpose of call by value in java?

Simple types are passed by value in Java. For example: void meth(int a) { // code } meth(34); // 34 is passed by value


What does a void method do?

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


Why void is restriction in java main function?

becoz the main program doesnot return any value to the os.


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.


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.


Why void main is used except int main in java?

void to indicate the application is not returning the exit code to the outer calling process. The outer calling process is another program (not necessary written in java), the human invoke the program on OS level, a batch job/script, etc. It works just like any method in java. main() itself is a method.


How do you create a log In page using java swing?

import javax.swing.JOptionPane; public static void main (String[]args){