object oriented programming using java code example
Example: object orientation in java
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();
}
}