main() be overloaded in java....java and cpp both are obeject oriented...why programmer does not overloaded main function in c++ | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

main() be overloaded in java....java and cpp both are obeject oriented...why programmer does not overloaded main function in c++

12th Oct 2017, 5:24 AM
Ashish Patel
Ashish Patel - avatar
1 Resposta
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; } }
12th Oct 2017, 7:28 AM
ChaoticDawg
ChaoticDawg - avatar