Static method can be overload as well as main method can be overload!

class S

{

                public static void main()

                {

                                System.out.println("main() Method Overload");

                }

                public static void main(String arg[])

                {

                                System.out.println("main() Hi");

                                S.main();

                }

}

main method overload.PNG
class S

{

                static

                {

                                S.main();

                }

                public static void main()

                {

                                System.out.println("main() Method Overload");

                }

                public static void main(String arg[])

                {

                                System.out.println("main() Hi");

                }

}

main method overload Static block.PNG
, , , , , , , , ,

Leave a Reply