Can u overload main()method.Give with example.
Answer Posted / kuldeep
yes it is possible in java but jvm call only one main()
method. for eg.
class test
{
public static void main(String []ar)
{
System.out.println("his is 1 st main() method");
}
public static void main(String ar[],String []st)
{
System.out.print("overloaded main() method");
}
}
but o/p of this program is: 1st main() method statement is
display. but why its ans. is at complile time String ar
argument contain one argument it is class name for making a
class file or byte code file. 2 arg store the one class
name it is not possible
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
What is split return?
What's the difference between an abstract class and interface in java?
When is update method called?
What are the two ways of implementing multi-threading in java?
Can we nested try statements in java?
how are methods defined?
What is meant by class and object in java?
Is zero a positive integer?
Is void a keyword in java?
What is the inheritance?
What are java threads?
Can a top level class be private or protected?
What do you mean by inner class in java?
What does I ++ mean?
How do you format in java?