I've been trying to see output from P1.java when I run P2.
I'm executing P1.afancymethod() from P2, but the print statement does not appear when I run it. I don't get output when I execute P2.afancymethod() either. Any suggestions?
Btw, I compile P1 with
'c:\jdk1.3\bin>javac -d c:\jdk1.3\bin P1.java' to create MyPackage.
Thanks,
Doug
//File P1.java
package MyPackage;
class P1{
void afancymethod(){
System.out.println("What a fancy method");
}
}
// import MyPackage.*;
class P2 extends P1 {
public void afancymethod() {
System.out.println("P2.afancymethod()");
}
public static void main(
String args[]) {
P2 p2 = new P2();
P1 p1 = new P1();
p1.afancymethod();
p2.afancymethod();
}
}