Skip to content

Commit

Permalink
Inheritance in Java
Browse files Browse the repository at this point in the history
  • Loading branch information
VaibhavS0710 committed Oct 22, 2024
1 parent b2be38b commit 252df4c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Java/examples/Vehicle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
public class Vehicle {
void engine(){
System.out.println("350cc");
}
}
class honda extends Vehicle{
void shine(){
System.out.println("tubeless tyre");
}
}
class hero extends honda{
void splendor(){
System.out.println("Best quality");
}
}
class Inheritance{
public static void main(String[] args) {
hero b = new hero();
b.splendor();
b.shine();
b.engine();
}
}

0 comments on commit 252df4c

Please sign in to comment.