Check out example codes for "java how to define a function". It will help you in understanding the concepts better.

Code Example 1

//declare a function like this:
void function(int parameter1)
	//function body
//call the function like this:

Code Example 2

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;

Learn ReactJs, React Native from