import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
//method = a block of code that is executed whenever it is called upon
String name = "Bro";
int age = 21;
hello(name, age);
}
static void hello(String name, int age) {
System.out.println("Hello "+name);
System.out.println("Hello "+age);
}
}
Second Methods
import java.util.ArrayList;
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;
}
}
Top comments (0)