Given below the sample code :
1. class Example13
2. {
3. void Method(int i) {System.out.println("int version");}
4. void Method(String s) {System.out.println("String version");}
5. public static void main(String args[])
6. {
7.
Example13 obj = new
Example13();
8. char ch = 'c';
9. obj.Method(ch);
10. }
11. }
What will be the output of the following ?
1. Error at Line 4 because void methods can't be overridden.
2 Error at line 9, an exception will be thrown.
3. Prints : int version.
4. Prints : String version.
(4)
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.