What restrictions are placed on method overloading?



What restrictions are placed on method overloading?..

Answer / Kunjan Bharti

For method overloading, there are no restrictions on the number of parameters or their types. However, the parameter names can be the same and should have different data types or the same data type with a different order. Also, the return type can be the same but should not be void.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is considered an anti pattern?

1 Answers  


INTERVIEW QUESTION FOR ANDROID

0 Answers  


What is the immediate superclass of Menu?

3 Answers  


What are legal modifiers that we can use to declare an inner class?

1 Answers   Infosys,


How are destructors defined in java?

1 Answers  


What is the purpose of the System class?

1 Answers  


In case of inheritance what is the execution order of constructor and destructor?

1 Answers   Agilent,


What does compareto () do in java?

1 Answers  


Why does java not support operator overloading?

1 Answers  


If I will write String s=new String("XYZ"); String s1=new String("XYZ"); if(s.equals(s1)){ sop("True"); } else{ sop("False"); } This program will give me "True". But When I am creating my own class suppose class Employee{ public Employee(String name); } Employee e= new Employee("XYZ"); Employee e1 = neew Employee("XYZ"); if(e.equals(e1)){ sop("True"); } else{ sop("False"); } Then it will give the output as "False". Can I know what is happening internally?

5 Answers  


What classes can be used to store arbitrary number of objects ?

1 Answers  


Can extern variables be initialized?

1 Answers  


Categories