Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Main method overloading

Have Programming Question? Ask it here!
 
 
 


samar
Main method overloading
1 Answer(s)      3 years and 10 months ago
Posted in : Java Interview Questions


Can we overload main()method?

Advertisement
View Answers

October 30, 2010 at 10:57 AM


Hi,

Here is the answer,

Yes. the main() method is a special method for a program entry. You can overload main() method in any ways. But if you change the signature of the main method, the entry point for the program will be gone.

public class Single {

    public static void main() {
        System.out.println("I am overloaded main method!");
    }

    public static void main(String[] args) {
        main();
    }

}

Thanks.



Related Tutorials/Questions & Answers:
Main method overloading
Main method overloading  Can we overload main()method
method overloading
method overloading   public void test(int a); pulic void test(long a);which sutiation x.long is called
Advertisements
Method Overloading
Method Overloading  In java can method be overloaded in different class
Method Overloading
Method Overloading  In java can method be overloaded in different class
method overloading
method overloading  public void test(int a){} public void test(long a){} i will call some x.test(125) which method is called pls tell me
method overloading
method overloading  public void test(int a) public void test(long a) public void test(object a) i will call some x.test(1258448); which method is called if it is called first one why it not call the third one
method overloading
method overloading  what is output of this program & why class Test { public void display(String msg) { system.out.println(msg); } public void display(Object msg) { system.out.println(msg
method overloading in c program
method overloading in c program  how is method overloading in C program is different from C++ program
JAv method overloading
JAv method overloading  What restrictions are placed on method overloading
Method overloading in java program
Method overloading in java program  How can we use method overloading in java program?   Method overloading:?In method overloading methods... are passing two char type parameters. In main method we are calling the all three
method overloading - Java Beginners
is referred to as Method Overloading. In the given example, we have defined... void main(String args[]) { MethodOverloading overloading = new MethodOverloading...method overloading   Write a program to demonstrate the method
main method
main method  Why is the java main method static
main method
main method  What is the argument type of a program's main() method
main method
in paranthesis denote?   Hi Friend, public-It indicates that the main() method can be called by any object. static-It indicates that the main() method is a class method. void- It indicates that the main() method has no return value
main method
can not make multiple main with in the same class program fails to compile. Compiler gives error that the main method is already defined in the class...main method  hello, Can I make multiple main methods in the same
What restrictions are placed on method overloading?
What restrictions are placed on method overloading?   Hi, What restrictions are placed on method overloading? thanks
main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program
Method Overloading Example In Java
Method Overloading Example In Java In this section we will read about overloading in Java. Method overloading in Java is achieved due to the Java supports... with the same name. The concept of method overloading allows the Java programmer
What is use of method overloading and overriding?
What is use of method overloading and overriding?  Method overriding...() method of Object class, we can use it with different classes. Overloading... but by overloading, you can add values of all data types. Java Method Overloading Java
Java method overloading
Java method overloading       Example below demonstrates method overloading in java. In java  method overloading means creating more than a single method with same name
Polymorphism : Method Overloading
In this tutorial you will learn one of polymorphism concept that is method overloading with example in Java 7
What is the arguement of main method?
What is the arguement of main method?  hi, What is the arguement of main method? thanks,   Hi, For main() method accepts only an array of String object as arguement. For moe details on http://www.roseindia.net/java
Can a main method be overloaded?
Can a main method be overloaded?   Hi, Can a main method... number of main() methods with different Signature and implementation in the class...-Questions/11577-Main-method-overloading.html
Java Method Overloading - Java Beginners
Java Method Overloading  can method be overloaded in subclass or not?  Hi Friend, Yes A subclass can overload the methods.For Example...: http://www.roseindia.net/java/master-java/method_overloading.shtml Thanks
Overloading
Overloading  program in method overloading it compile successfully and gives error in run time?   Hi Friend, Post your code. For more information, you can visit the following link: Method Overloading Example Thanks
Overloading
Overloading  Overloading in JAVA
Method Overloading
Method Overloading       As we know that a method have its own signature which is known by method's name... are different. When the main class call the method the method executes on behalf
When is java main method called?
When is java main method called?  When is java main method called? Please explain the main method in Java with the help of code.   In a java class, main(..) method is the first method called by java environment when
What is the return type of the main method?
What is the return type of the main method?  hi, What is the return type of the main method? thanks   Hi, In the java programming the Main() method doesn't return anything hence declared void. In Java, you need
calculate volume of cube, cylinder and rectangular box using method overloading in java
calculate volume of cube, cylinder and rectangular box using method overloading... method overloading in java   calculate volume of cube, cylinder and rectangular box using method overloading in java
What if the main() method is declared as private?
What if the main() method is declared as private?  Hi, What if the main() method is declared as private? Thanks   Hi, I have found some reference site for java programming coding for Main() method is declared
Can a main method be declared final?
Can a main method be declared final?   Hi, Can a main method be declared final? Thanks   Hi, Yes we can. The final method can... be override in a subclass. for more about main method be declared final in Java
Why is the main method declared static?
Why is the main method declared static?  Hi, Why is the main method declared static? thanks   Hi, When we declare main() method in any Java class always has the same signature, and we declare public static void main
What is the first argument of the String array in main() method?
What is the first argument of the String array in main() method?  Hi, What is the first argument of the String array in main() method? Thanks... of the String array in main() method
Method Overloading in java
Method Overloading in java      ...: 1. Method Overloading 2. Method Overriding   Here we will discuss only the concept of Method Overloading: -- In a class, the concept of method
Constructor overloading in java
method overloading, in method overloading you have multiple method with same...=new Demo(10,15); System.out.println("In main method...Constructor overloading in java In this section we will discuss about
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
that the program recquires a main() method in order to be runned - here is the following code...Till Slip Program Error Free - No Main Method  Hi there i am a java...() { initComponents(); } /** * This method is called from within
overloading and overriding
overloading and overriding  hello, What is the difference between overloading and overriding?   hii Overloading: Overloading is nothing but passing the different parameters to the method. Here method name is same
write a program to calculate volume of a cube, cylinder, rectangular box using method overloading
write a program to calculate volume of a cube  write a program to calculate volume of a cube, cylinder, rectangular box using method overloading... class MethodOverloading { public static void main(String args
Overloading in java
The overloading in seen with the constructor and the methods of the class The following link have all the details Constructor overloading in Java Method overloading in Java
Should a main method be compulsorily declared in all java classes?
Should a main method be compulsorily declared in all java classes?  hi, Should a main method be compulsorily declared in all java classes? thanks   Hi, There is no need of main method be compulsorily declared
Accessing non-static members through the main method in Java.
Accessing non-static members through the main method in Java.  As an oop rule, a static method can have access only to static variables and static methods. If it is so, an obvious question arises as to how can the main() method
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
overloading - Java Server Faces Questions
overloading  define overloading   Hi Friend, Overloading is the ability to define more than one method with the same name in a class...); } } class Overload { public static void main(String args[]) { Overloading
 

 

 

DMCA.com