java method overriding
// Base Class
class Parent {
void show(){
System.out.println("Parent's show()");
}
}
// Inherited Class
class Child extends Parent {
// This method overrides show() of Parent Class
@Override
void show(){
System.out.println("Child's show()");
}
}
// Main class
class Main {
public static void main(String[] args){
Parent obj = new Child();
// Calling Child Class Method
obj.show();
}
}
Also in Java:
- java lerp
- foreach java
- create instance object java
- spigot sounds
- java call another constructor
- java arraylist
- how to create a hashmap in java
- using get in map in java
- working with buttons in applet java
- java script removing first three indexes
- graal.js pass javascript array to java function
- covariant type in java
- list in java
- jackson ignore value if null
- how to check if rs next is null
- How to do press enter to continue in java
- nextchar in java
- java sort array descending
- java android development find element by id
- java run project from command line
- money value commas java
- raspberry stackexchange how to install the java jdk
- java break in foreach
- java code to concatinate integer