0
main() be overloaded in java....java and cpp both are obeject oriented...why programmer does not overloaded main function in c++
2 Answers
0
The main method in Java can be overloaded, however the JVM will only call the main method that matches the:
public static void main(String[] args)
signature, access modifiers, and return type. An overloaded main method will need to be called from within this main method or another method.
public class Program
{
public static void main(String[] args) {
System.out.println(main(5, 4));
}
public static int main(int a, int b) {
return a+b;
}
}