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

Code Example 1

class Person {
 void walk() {
  System.out.println(“Can Run….”);
 }
}
class Employee extends Person {
 void walk() {
  System.out.println(“Running Fast…”);
 }
 public static void main(String arg[]) {
  Person p = new Employee(); //upcasting
  p.walk();
 }
}

Learn ReactJs, React Native from akashmittal.com