How can I extend the function only in place of the entire class in Java?


How can i extend functions only in Java? (not class extends)

 * year 1990 Alex Kumar
 * year 1990 Jhon Ya'ay
 * made this: do not touch modify here */
public static void OldMade()

 * year 2011 Sunil Williams
 * applied which extends 1990 */
public static void MadeInIndia extends this.OldMade
    //hidden include Connect("+1800PIZZA");
    //hidden include Say("MYID:69");
    //hidden include Request("PIZZACITROEN_BLACK");

private static void main(Strig args[])
    // Try 1 call and get old + new

    //execute  Connect("+1800PIZZA");
    //execute  Say("MYID:69");
    //execute  Request("PIZZACITROEN_BLACK");
    //execute  Send("CorrectionPandit");

Can't be done. Java's object-oriented; you only inherit and extend from classes and interfaces.

You don't "extend" static methods. In the following arrangement, class B's static version of foo will overshadow that from A. If B needs to call A's static method, it can do so explicitly:

public class A {

    public static void foo() { System.out("foo for A classes"); }

public class B extends A {

    public static void foo() { System.out("foo for B classes"); }