Since you cannot use Java 8, this is what you can do.
Create an interface called Method:
public interface Method {
public boolean call(int value1,int value2,int value3);
}
Create an implementation of a method called SubMethodA:
public class SubMethodA implements Method {
@Override
public boolean call(int value1, int value2, int value3) {
int A = value1;
int B = value2;
int C = value3;
return A|B|C;
}
}
Create a main class containing mainMethod:
public class Main {
public static void mainMethod(Method method,int value1,int value2,int value3) {
method.call(value1, value2, value3);
}
}
Now you can call mainMethod as follows:
Main.mainMethod(new SubMethodA(),1,2,3);
- mainMethod, , .java , :
Main.mainMethod(new Method() {
public boolean call(int value1, int value2, int value3) {
int A = value1;
int B = value2;
int C = value3;
return A|B|C;
}
},1,2,3);