java methods

java methods tutorial explained

#java #methods #tutorial

public class main {

public static void main(string[] args) {

// method = a block of code that is executed whenever it is called upon

int x = 3;
int y = 4;

int z = add(x,y);

system.out.println(z);
}

static int add(int x, int y) {

int z = x + y;
return z;

}

}

java methods