Re: Cant a class extends a abstract class and implements a interface at once??
It appears something else is going on. Here is an example (the class
relationship is taken from the last "Real Time with Bill Maher"):
package experiment;
abstract class misanthrope {
abstract Class dislikes();
}
interface bigot {
void intolerate(Class c);
}
class Woman {}
class misogynist extends misanthrope implements bigot {
Class dislikes() { return Woman.class; }
public void intolerate(Class c) {
System.out.println("I am intolerant of " + c);
}
}
class AbstractAndInterface {
static public void main(String args[]) {
misogynist m = new misogynist();
m.intolerate( m.dislikes() );
}
}
Your post contains mistakes like using the word "externs" for "extends"
and I'm pretty sure your compiler said more than "Cant find sign!" and
said it more correctly too.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
moxosyuri@gmail.com wrote:
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:)