Created
August 4, 2022 05:25
-
-
Save yuvraj650/f4e7ff0510aaaa57821ff3b3a1706b0c to your computer and use it in GitHub Desktop.
Example OverRidding in JAVA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yuvrajworld; | |
class A | |
{ | |
public void f1(int x) | |
{ | |
System.out.println("class A"); | |
} | |
} | |
class B extends A | |
{ | |
public void f1(int x) | |
{ | |
System.out.println("Class B"); | |
} | |
} | |
public class Main | |
{ | |
public static void main (String[]args) | |
{ | |
B obj = new B(); | |
obj.f1(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment