+ 2

Help ! Example of main function overloading

Can main method be overloaded in java The basic signature of the main can be changed like public static void main (int args ) Will that be fine or how can we overload it

24th Jun 2019, 3:09 PM
Ayush Pandey
Ayush Pandey - avatar
3 Respostas
24th Jun 2019, 3:25 PM
A͢J
A͢J - avatar
+ 3
yes you can import java.util.Arrays; public class Program { public static void main(String[] args) { System.out.println( "main String" +Arrays.toString(args) ); main(new int[]{10}); } public static void main(int[] args) { System.out.println( "main int" +Arrays.toString(args) ); } } output: main String[] main int[10]
24th Jun 2019, 4:12 PM
zemiak
+ 3
Thank u guyz for ur help! :)
24th Jun 2019, 4:58 PM
Ayush Pandey
Ayush Pandey - avatar