Your own methods
Read · 1 of 4
A method has inputs and a result
static int square(int x) { return x * x; } makes a method called square. It takes an int called x and gives back (returns) an int.
Methods go inside the class, next to main (not inside it). Use void when a method doesn't return anything. Calling square(3) runs it with x = 3.