Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

can we override the overloaded method in java

class MultiplicationTest {
 
    public void multiplication(int num1, int num2) {
        System.out.println(num1 * num2);
    }
 
    public void multiplication(int num1, int num2, int num3) {
        System.out.println(num1 * num2 * num3);
    }
 }
 
public class Main extends MultiplicationTest
{
    public void multiplication(int num1, int num2) {
        System.out.println(num1 * num2);
    }
	public static void main(String[] args) {
		MultiplicationTest multiplicationTest = new MultiplicationTest();
		multiplicationTest.multiplication(30, 2);
		multiplicationTest.multiplication(14, 5, 25);
		Main main = new Main();
		main.multiplication(15, 5);
	}
}
Source by www.w3schools.blog #
 
PREVIOUS NEXT
Tagged: #override #overloaded #method #java
ADD COMMENT
Topic
Name
3+1 =