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 string is utf8?
Explain heap sort?
What is the need of transient variables in Java ?
If a method is declared as protected, where may the method be accessed?
Why is core java important?
Write a program to print all permutations of string?
Do you know how to reverse string in java?
What does sizeof return?
What are the methods of object class ?
How do I enable java in safari?
What is string made of?
Is upper case in java?
What is the += operator called?
Explain different types of thread priorities ?
What is printwriter in java?