answersLogoWhite

0


Best Answer

Yes, you can very well overload the main method but, the main method that would get invoked by the JVM when you try to run this class would be the main method that has the below signature:

public static void main(String[] args) {

...

}

All other main methods would be accepted by the Compiler but only the above method would get called when you run the class

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can main method be overloaded illustrate with example program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can static method can be overloaded or not?

Yes, a static method may be overloaded.


Which operational definition does Schaefer use in his research example to illustrate the scientific method?

your a black person


What are duplicate java method names?

overloaded methods.


How does the elephant poem illustrate the importance of observation in the scientific method?

How does this poem illustrate the importance of observation in the scientific method


Can a main method in java be overloaded?

Yes. The main method is just like any other java method and can be overloaded. But - Only the method with public static void main(String[] args) signature will get invoked when the class is run.


How are data and method organised in object-oriented program Illustrate the same for car object?

For example, given a base class of "Car," polymorphism enables the programmer to define different "StartEngine" methods for any number of derived classes. The "StartEngine" method of a derived class named "DieselCar" may be completely different from the method with the same name in the base class.


How many number of argument are there in round method?

The round method of the Math class is overloaded. You can either pass a double or a long into the round method


Can you override method in the same class?

You cannot override a method inside the same class. If you do that, it is called Overloading. Experienced java programmers can clearly identify the difference between overloaded methods and the overridden ones. We just had a detailed look at overridden methods and it is time to take a look at the overloaded ones. Overloaded methods let you reuse the same method name in a class, but with different arguments (and optionally, a different return type). Overloading a method often means you're being a little nicer to those who call your methods, because your code takes on the burden of coping with different argument types rather than forcing the caller to do conversions prior to invoking your method. The rules are simple: • Overloaded methods MUST change the argument list. • Overloaded methods CAN change the return type. • Overloaded methods CAN change the access modifier. • Overloaded methods CAN declare new or broader checked exceptions. • A method can be overloaded in the same class or in a subclass. In other words, if class A defines a doStuff(int i) method, the subclass B could define a doStuff(String s) method without overriding the superclass version that takes an int. So two methods with the same name but in different classes can still be considered overloaded, if the subclass inherits one version of the method and then declares another overloaded version in its class definition.


How do you illustrate one million?

If by illustrate, you meant demonstrate by showing a real life example, then here is one method: Start counting each second right now and keep counting for about eleven and a half days to get to a million.


Method overloading in java?

No.In C++, you can overload both methods, and existing operators - although you can't invent new operators.In Java, many things that might cause confusion were eliminated; one of these is operator overloading. However, you can still overload methods, and this is sometimes very useful.


Explain any 8 difference between overloading and overriding?

Overriding methods that are in the parent class is to redefine them in the current (child) class in a different way. Like if you're extending a class but you don't like the behavior of one method in that class, you can override that method and write your own code. Overloading a method in the current class is defining another copy of the method with different signature. They call them overloaded methods. This is an example of overloaded methods: myMethod(int i, int b){ .... } myMethod(String s) { ... } myMethod(boolean b) {...} Hope that was clear


What are the various methods of valuation of shares discribe and illustrate net asset method of valuing shares?

They include; Intrinsic Value Method, Yield Method and Net Asset Method.