• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiler Error when instantiating a class  RSS feed

 
Jacob Steingart
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
The compiler is telling me that I need a return type for my constructor when I know I don't. Here is the constructor code:



and here is my instantiating code:



I was just testing out the Assignment constructor for a small personal project I'm doing to help me organize my work. Kind of ironic that I'm not doing homework by writing software to help me organize and do homework... anyhow, if anyone notices what I'm doing wrong, I would greatly appreciate help. Thanks in advance!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob,
You've got a typo in the constructor names. Check for the letter "n" is the constructors. It's in the class name, but missing in action from the constructor.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And because it no longer matches the class name, the compiler treats it as a method.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!