• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructor undefined error

 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my code



The problem is that when i run, i get the constructor undefined error at line -->children.add(new MSS(counter++, this, id_start )); , which i am not able to find why??

can someone explain the reason?
 
Henry Wong
author
Marshal
Pie
Posts: 21419
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
piya rai wrote:
The problem is that when i run, i get the constructor undefined error at line -->children.add(new MSS(counter++, this, id_start )); , which i am not able to find why??

can someone explain the reason?


Well, does the MSS class have a constructor that takes an int, an Network instance, and an int as the three parameters?

Henry
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean line 24??
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post the class MSS's code?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup! put the coding of class MSS!
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@piya rai : You should find out a Paramaterised Constructor in MSS class which is
having an int, a Network object and one more int.

If there isnt any like above in MSS. You need to make some changes to your code.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does this have to do with the SCJP exam? I'm moving this to a more appropriate forum.

Note that there's a semi-colon in line 18 which should not be there.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please avoid everybody saying the same thing several times.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young wrote:What does this have to do with the SCJP exam? I'm moving this to a more appropriate forum.

Note that there's a semi-colon in line 18 which should not be there.


That's legal.... see the coding below. It compiles fine & runs fine. And the output is 10.

 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper is correct; the semi-colon ought not to be there. The fact that an empty statement will compile doesn't mean it ought to be there.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Jesper is correct; the semi-colon ought not to be there. The fact that an empty statement will compile doesn't mean it ought to be there.


You mean....


Ok. It's clear to me! On that question, then in that question, that's not a problem. We needn't consider it.

 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
piya rai wrote:
The problem is that when i run, i get the constructor undefined error at line -->children.add(new MSS(counter++, this, id_start )); , which i am not able to find why??

can someone explain the reason?


Well, does the MSS class have a constructor that takes an int, an Network instance, and an int as the three parameters?

Henry



yes it does..
 
Henry Wong
author
Marshal
Pie
Posts: 21419
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
piya rai wrote:
Henry Wong wrote:
piya rai wrote:
The problem is that when i run, i get the constructor undefined error at line -->children.add(new MSS(counter++, this, id_start )); , which i am not able to find why??

can someone explain the reason?


Well, does the MSS class have a constructor that takes an int, an Network instance, and an int as the three parameters?

Henry



yes it does..


Well, your compiler says otherwise. So... As many has already mentioned, show us the code. Or we really can't help you.

Henry
 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
piya rai wrote:
Henry Wong wrote:
piya rai wrote:
The problem is that when i run, i get the constructor undefined error at line -->children.add(new MSS(counter++, this, id_start )); , which i am not able to find why??

can someone explain the reason?


Well, does the MSS class have a constructor that takes an int, an Network instance, and an int as the three parameters?

Henry



yes it does..


Well, your compiler says otherwise. So... As many has already mentioned, show us the code. Or we really can't help you.

Henry


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic