Check out example codes for "what are method in java". It will help you in understanding the concepts better.

Code Example 1

Static methods: A static method is a method that can be called and executed without creating an object
Instance methods: These methods act upon the instance variables of a class
Factory methods: A factory method is a method that returns an object to the class to which it belong

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;

Code Example 3

public class MyClass {
  private int value = 10;
  // getter method
  public int getValue() {
    return value;
  // setter method
  public void setValue(int value) {
    this.value = value;

Learn ReactJs, React Native from