• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Constructor undefined error

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 23949
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you mean line 24??
 
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please post the class MSS's code?
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yup! put the coding of class MSS!
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79036
375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please avoid everybody saying the same thing several times.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79036
375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23949
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic