Getting an error about an undefined method(constructor) when I'm looking right at it? (Java) -


i'm getting error here says haven't defined method, right in code.

class subclass<e> extends exampleclass<e>{       comparator<? super e> c;       e x0;        subclass (comparator<? super e> b, e y){            this.c = b;            this.x0 = y;       }        exampleclass<e> addmethod(e x){            if(c.compare(x, x0) < 0)                return new othersubclassextendsexampleclass(c, x0, subclass(c, x));                 //this error                        ^^^^^^       } 

i did define constructor subclass, why saying didn't when try pass in return statement?

you want new subclass(c, x) instead of subclass(c, x). in java invoke constructor in different way method: new keyword.

more on subject.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -