signature object in java code example
Example 1: 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();
}
}
Example 2: string method example in java
public String concat(String s)
String x = "book";
System.out.println( x.concat(" author") ); // output is "book author"