Given the following sample code:
class Example4{
public float Twin(float a, float b) {
return 0F;
}
public int Twin(int a, int b) {
return 0;
}
}
Is the above sample code correct ?choose the correct reason :
1. Incorrect , methods can't have the same name.
2. Incorrect , methods must not use same number of arguments.
3.Correct, method overloading is used.
4.Incorrect ,must use in different class.
(3)
In method overloading ,same name methods can have same number of arguments but type must be differnt.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.