Sunday, 21 April 2013

Class -8-


package net.dharmaraj;

public class TechnoSample {
public static void main(String args[]) {
TechnoSample t = new TechnoSample();
TechnoSample d = new DerivedSample();
d.echoN(d.paramA);

}

int paramA = 9;

void echoN(int n) {
System.out.println("number is in Base " + n);
}
}

class DerivedSample extends TechnoSample {
int paramA = 3;

void echoN(int n) {
System.out.println("number is in Derived " + n);
}
}

Answer :--

number is in Derived 9

No comments:

Post a Comment