Check out example codes for "overriding in java". It will help you in understanding the concepts better.

Code Example 1

using method-override in your index.js
1. npm install method-override --save
2. var methodOverride = require("method-override");
3. app.use(methodOverride("_method"));
//'_method' is what methodOverride will look for
method override in your UPDATE route: 
* <form action = "/campgrounds/<%=campground._id%>/edit?_method=PUT" 
	method = "POST">
and EDIT routes:

Code Example 2

class Animal {
   public void move() {
      System.out.println("Animals can move");
   }
}

class Dog extends Animal {
   public void move() {
      System.out.println("Dogs can walk and run");
   }
}

public class TestDog {

   public static void main(String args[]) {
      Animal a = new Animal();   // Animal reference and object
      Animal b = new Dog();   // Animal reference but Dog object

      a.move();   // runs the method in Animal class
      b.move();   // runs the method in Dog class
   }
}

Code Example 3

// 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(); 
    } 
}

Code Example 4

// A Simple Java program to demonstrate 
// method overriding in java 
  
// Base Class 
class Parent { 
    void show() 
    { 
        System.out.println("Parent's show()"); 
    } 
} 
  
// Inherited class 
class Child extends Parent { 
    // This method overrides show() of Parent 
    @Override
    void show() 
    { 
        System.out.println("Child's show()"); 
    } 
} 
// Driver class 
class Main { 
    public static void main(String[] args) 
    { 
        // If a Parent type reference refers 
        // to a Parent object, then Parent's 
        // show is called 
        Parent obj1 = new Parent(); 
        obj1.show(); 
  
        // If a Parent type reference refers 
        // to a Child object Child's show() 
        // is called. This is called RUN TIME 
        // POLYMORPHISM. 
        Parent obj2 = new Child(); 
        obj2.show(); 
    } 
}

Learn ReactJs, React Native from akashmittal.com