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
In java, what is the difference between method overloading and method overriding?
What is math in java?
What are the different types of collections in java?
what is meant by HQL?
State two differences between C and Java.
Why singleton class is used in java?
How hashmap works in java?
What is meant by tab pans?
What is the difference between throw and throws in java?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
How are java objects passed to a method and what are native methods?
What is a jagged array in java?
Can we write method inside a method in java?
Which is best ide for java?
What is assembly language?