Skip to content

Commit

Permalink
Merge pull request #263 from VaibhavS0710/first
Browse files Browse the repository at this point in the history
Inheritance in Java
  • Loading branch information
BlackIQ authored Oct 23, 2024
2 parents 594ee49 + 252df4c commit 5bdb454
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 5bdb454

Please sign in to comment.