Skip to content

Commit

Permalink
feat: Add example method overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajeet-29-pro committed Dec 20, 2024
1 parent 0527e8a commit 155205e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.practice.dsa.asked_in_interview;

public class A {
public void printMethod() {
System.out.println("A");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.practice.dsa.asked_in_interview;

public class B extends A{
@Override
public void printMethod() {
super.printMethod();
System.out.println("B");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.practice.dsa.asked_in_interview;

import java.util.UUID;

public class C extends B{
@Override
public void printMethod() {
super.printMethod();
System.out.println("C");
}

public static void main(String[] args) {
C c = new C();
c.printMethod();
UUID uuid = UUID.randomUUID();
System.out.println(uuid);
}
}

0 comments on commit 155205e

Please sign in to comment.