can we overload main method?

Answers were Sorted based on User's Feedback



can we overload main method?..

Answer / thiru.guru83@yahoo.com

yes

Is This Answer Correct ?    14 Yes 1 No

can we overload main method?..

Answer / shrirang & chetak

yes , we can overlode main method but we can not override
main method

example :
class a
{
public void main()
{
System.out.println("0.00000000");
}

public static void main(String ar[])
{
a A=new a();
A.main();
}
}

Is This Answer Correct ?    13 Yes 4 No

can we overload main method?..

Answer / pradeep

yes i agree with chetak. we can overload but we can't override

Is This Answer Correct ?    7 Yes 3 No

can we overload main method?..

Answer / sujith.v.m

Yes,
Because signature is different in main function so it will be overloaded.

Is This Answer Correct ?    5 Yes 2 No

can we overload main method?..

Answer / mounika

yes we can overload becoz we can use different signatures to main method

Is This Answer Correct ?    4 Yes 2 No

can we overload main method?..

Answer / teja

no

Is This Answer Correct ?    10 Yes 9 No

can we overload main method?..

Answer / atul

class mainoverloaded
{
public void main()
{
System.out.println("Hey");
}
public void main(int a)

{
System.out.println(a);
}
}
class maind
{
public static void main(String ah[])
{
mainoverloaded m=new mainoverloaded();
m.main();
m.main(10);
}

}
please execute this code.it is execute correctly.

Is This Answer Correct ?    1 Yes 0 No

can we overload main method?..

Answer / srinivaskumar.nimmana

Yes, we can... like this,

public static void main(String[] args){....}
pulbic void main(int a){....}
public static int main(flaot f){....}
public String main(string s){....}

in the above code public static void main(string[] args) executed as thread remaining methods are normal methods in our java class. in jvm p.s.v.main(string[] args) defined with thread so jvm always search for this syntax only.any other main() with diffrent parameters are consider as normal method

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

Why is java not 100% pure oops?

0 Answers  


Name component subclasses that support painting in java programming?

0 Answers  


Suppose there is an Online shopping cart application having different objects like Cart, SelectionItem, Billing, COnfiguration, Authentication, Authorization, PersonalDetails etc. Out of this which one can be made a singleton pattern and why?

2 Answers   RBS,


What are the four corner stones of oop?

0 Answers  


What is difference between variable declaration and definition?

0 Answers  






Java support what type of parameter passing ?

7 Answers   Wipro,


all are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined classes and we can extend atmost one class so each class can extend more than one class so java supports multiple inheritance?i am confused with this,pls any one explain me.

8 Answers   CFG,


How do I type unicode?

0 Answers  


Is constructor inherited?

0 Answers  


Why do we need hashset in java?

0 Answers  


how to print the below in java?thanks in advance.... * * * * * * * *

3 Answers  


Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview

0 Answers   L&T,


Categories