can we overload main method?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it safe to install java on my computer?

541


Is empty .java file name a valid source file name?

586


What is meant by call by reference?

511


Is null a keyword in java?

557


What is the inheritance?

549






Define jre i.e. Java runtime environment?

574


What about features of local inner class?

621


What best practices should you follow while writing multithreaded code in java?

541


Explain an intermediate language?

508


How can I right-justify a string?

627


What does super keyword do?

560


What is scope & storage allocation of global and extern variables? Explain with an example

579


What is the escape character in java?

513


What is a percentage sign called?

621


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

1822