Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Parent {
void parentMethod(){
System.out.println("This is parent class");

}
}
class Child extends Parent{
void childMethod(){
System.out.println("This is child class");
}


}
public class Main
{public static void main(String[] args) {
Parent p= new Parent();
Child c= new Child();
p.parentMethod(); //method of parent by object of parent

c.childMethod();//method of child class by object of child class
c.parentMethod();//method of parent class by object of child class
}
}