Which code line/lines should be placed at line 6 to run following program ?
1. class Example1{
2. public static void main(String[] args) {
3. Twin(1);
4. Twin(1,2);
5. }
6. // place the code here
7. }
Which statements below can be placed at line 6 to run above program ?
1. static void Twin(int i ) { }
2. static void Twin(a,b,c) { }
3. static void Twin(int i, int j) { }
4. need not to add any code to run this program.
(1) & (3)
In Method overloading, same name methods with different number of arguments can be used. Methods must be define before using it.
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.