answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

No. The only way Java can distinguish between different versions of overloaded methods is the parameter list.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a main method in java be overloaded?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What are duplicate java method names?

overloaded methods.


What is the task of the main method in java platform?

It is the method that gets called when a Java application is started.


How to write java program without using main method?

Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)


Is it possible to override overloaded methods why?

Yes. Overloaded methods are also Java methods and all Java methods can be overridden.


How do you print message before main in java?

You cannot do that. The main method of a java class is the point where the execution begins. You can print messages only after a main method is invoked.


What is a getContentPane method in Java?

The getContentPane() method is used to get the main component in a Java Swing JFrame. It is usually a JPanel.


What will happen if a Java Class has no Main Method?

Nothing will happen. There is no restriction that every Java class must have a main method. The only program is that, this class cannot be executed as a standalone java program.


What is void main?

The main method is the first method, which the Java Virtual Machine executes. When you execute a class with the Java interpreter, the runtime system starts by calling the class's main() method. Themain() method then calls all the other methods required to run your application. It can be said that the main method is the entry point in the Java program and java program can't run without this method.The signature of main() method looks like this:public static void main(String args[])The method signature for the main() method contains three modifiers:public indicates that the main() method can be called by any object.static indicates that the main() method is a class method.void indicates that the main() method has no return value.


Can static method can be overloaded or not?

Yes, a static method may be overloaded.


How do you call main class with in main class in java?

We can't call a class. We always call a method in java.


What primitive type of array can be sorted using the Java build-in sort method?

By "Java built in sort method", I assume you are referring to Arrays.sort() in the java.util package. Arrays.sort() is overloaded to handle all primitive and Object types except boolean.


Why main is used in java?

In java need main() method. without main() in java we won't run the java programe main() signals the entry point to the program - it tells the Java Virtual Machine which is the first program that should be executed.