java how to define a function

Java
//declare a function like this:
void function(int parameter1)
{
	//function body
}
//call the function like this:
function(1);public static void main(String[] args)
{
	int length=getLength();
  	System.out.println("Your length is: "+length);
}
//methods are outside of main method
public static int getLength()
{
	int length=5;
  	return length;
}
Source

Also in Java: