Adventure game constructor method problems Java -


i'm creating text adventure game in java. i've created exit, room, creature , item class, , i'm instantiating , putting values them in main class.

i'm getting problem though: i'm creating exits room, i'm getting compiler error saying

constructor exit in class exit cannot applied given types

this line of code i'm getting compiler error for:

exit exit1 = new exit("exit1", "exit description", "exit transition text"); 

and in exit class have constructor method:

public void exit(string exit, string exitdescription, string exittransition) {     this.exit(exit, exitdescription, exittransition);        } 

but every time tell ide (netbeans) correct compiler error, generates in exit class:

exit(string exit1, string exit_description, string exit_transition_text) {     throw new unsupportedoperationexception("not supported yet."); //to change body of generated methods, choose tools | templates. } 

so question is, why doesn't constructor method work? also, had professor , believe said don't want generated code. don't remember though.

this not constructor:

public void exit(string exit, string exitdescription, string exittransition) { 

constructors have no return type.

this constructor:

public exit(string exit, string exitdescription, string exittransition) { 

of course know if valid constructor code in body doesn't make sense appears you're trying have constructor call recursively:

// void removed public exit(string exit, string exitdescription, string exittransition) {     this.exit(exit, exitdescription, exittransition); // calls itself! } 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -