java main method
public static void main(String args[]){}
calling a void method java
public class methods{
public static void main(String[] args){
printSum(5, 15); // Print 20
}
public static void printSum(int a, int b){
System.out.println(a + b);
}
// Our method should be outside the main methods bounds
// Call your function inside the main method.
}
void function
public void Yourvoidname()
{
//Whatever you want to happen when your void is called
}
//somewhere else in your script, for example start()
void Start()
{
Yourvoidname();
//when the start function is called(first frame) your void will be called
}
void method java
int a = 20;
int b = 20;
public static void sum(){ // Void Method
System.out.println(a + b);
}
public static int sum(){ // Return Function
return a + b;
}
what is void in java
Difference between void and return method
Void Method:
The "void" return type means that this
method doesn't have a return type.
It is mostly used for printing result
to console
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us