Can u overload main()method.Give with example.
Answer Posted / tushar
class Checkmain
{
public static void main(String args[])
{
System.out.println("helloCheckmain string main ");
}
}
class Checkmain1 extends Checkmain
{
public static void main(String args[])
{
System.out.println("helloCheckmain1 string main ");
}
}
public class Main
{
public static void main(String args[])
{
String S[]=new String[10] ;
System.out.println("******string main**********");
int q=10;
main(q);
Checkmain.main(S);
Checkmain1.main(S);
}
public static void main(int a
{
String S[]=new String[10] ;
System.out.println("000000000 int main 0000000000");
Checkmain.main(S);
Checkmain1.main(S);
}
}
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What are different types of multitasking?
What is a concrete classes? Is Java object class is concrete class?
Can inner class be public in java?
What are the steps involved to create a bean?
What is the advantage of preparedstatement over statement?
Is string a data type in java?
What is a databasemetadata?
What is the use of list in java?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
Explain about main() method in java ?
Is hashmap thread safe?
Why string is immutable with example?
What exactly is a .class file?
What are the advantages and disadvantages of object cloning?
What do you mean Abstraction in java?