M
moxosyuri
Hi, i`m a beginner in java, and i found a strange question when i
learning "interface",
can anyone help me?!
just like :
public interface Shout
{ ...
void Shout();
...
}
class abstract Person { ... }
class Worker externs Person implements Shout
{ ...
public void Shout() { System.out.println(...);}
...
}
main
{ ...
Worker man = new Worker(...);
man.Shout();
...
}
// when compliing, the jcreater whill warning "Cant find sign!" and
//point at the line "man.Shout();"
and i find if dont use "extends (a abstract class)"
or just try "abstract class XXX implements XXX" are all OK.
SO i suppose that MAYBE we cant use both of them at once in java...
Is that TRUE?? I DONT KNOW and wish someone can tell me what happened
in fact...
wanted your help!! thank you
learning "interface",
can anyone help me?!
just like :
public interface Shout
{ ...
void Shout();
...
}
class abstract Person { ... }
class Worker externs Person implements Shout
{ ...
public void Shout() { System.out.println(...);}
...
}
main
{ ...
Worker man = new Worker(...);
man.Shout();
...
}
// when compliing, the jcreater whill warning "Cant find sign!" and
//point at the line "man.Shout();"
and i find if dont use "extends (a abstract class)"
or just try "abstract class XXX implements XXX" are all OK.
SO i suppose that MAYBE we cant use both of them at once in java...
Is that TRUE?? I DONT KNOW and wish someone can tell me what happened
in fact...
wanted your help!! thank you