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 static in java?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
what is the purpose of "virtual"?
What will be the initial value of an object reference which is defined as an instance variable?
What are the elements of java?
What is string syntax?
What are the disadvantages of object oriented programming?
What is default exception handling in java?
What is application system?
What is the difference between throw and throws in java?
What is multi-catch block in java?
How long will it take to learn java?
Does variable declaration allocate memory?
List some important features of java 10 release?
What is pangram in java?