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 a flag and how does it work?
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?
How do you reverse a word in java?
Can we change the value of static variable?
What is the benefit of abstract class?
Are floats faster than doubles?
What is the purpose of garbage collection in java, and when is it used?
How does singleton class work?
Is string a class in java?
What is a concrete classes? Is Java object class is concrete class?
What are singleton services?
How many bits is a string?
Differentiate between a constructor and a method? Can we mark constructors final?
Does apple use java?
What is assembly condition codes?