Answer by Aniket Inge for Java constructor problem
public PassTheClass (String xMyName, String xMyEmotion) your constructor expects 2 arguments, you pass 3 arguments here: PassTheClass demo = new PassTheClass("Squidward",94,"proud");And the compiler...
View ArticleAnswer by Nathan Hughes for Java constructor problem
You are calling a constructor with three arguments, but you don't declare one like that. To make the code work you can add a constructor like this:public PassTheClass (String myName, int myGrade,...
View ArticleAnswer by Bohemian for Java constructor problem
Your constructor accepts String, String, but you're passing String, int, String.Either add an int parameter to the constructor, or remove the int from the call.My suggestion is to add an int parameter,...
View ArticleJava constructor problem
I created a class file, and a tester file. When I tried to use a constructor to create an object it wouldn't compile. It said "PassTheClassTester.java:5: error: constructor PassTheClass in class...
View Article
More Pages to Explore .....