You have to provide method overloads, that means the same method with different parameters:
static void someMethod(String name, int age) {
System.out.println(name + ": " + age);
}
static void someMethod(String name) {
System.out.println(name);
}
static void someMethod(int age) {
System.out.println(age);
}
Then you can do this:
public static void main(String[] args) {
String john = "John";
int ten = 10;
someMethod(john, ten);
someMethod(john);
someMethod(ten);
}
By the way, the line System.out.println(name, age);
will not compile...