inheritance bug?
"Jason Thomas" <[email protected]>
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
I have the following two files:
TestBase.java:
package test;
public class TestBase {
public void hello() {
System.out.println("hello java");
}
public static void main(String[] args) {
new Test().hello();
}
}
Test.nice:
package test;
public class Test extends TestBase {
public void hello() {
println("hello nice");
}
}
void main(String[] args){
new Test().hello();
}
When I run TestBase.java I get "hello java". When I run Test.nice I
get "hello nice". I was expecting to see "hello nice" in both cases.
So it seems that my Nice class isn't over-riding the hello method as
far as Java is concerned. Am I doing something wrong here?
Thanks!
Jason
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click