Forums Register Login

Constructor undefined error

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
you mean line 24??
+Pie Number of slices to send: Send
Can you please post the class MSS's code?
+Pie Number of slices to send: Send
yup! put the coding of class MSS!
+Pie Number of slices to send: Send
@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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Please avoid everybody saying the same thing several times.
+Pie Number of slices to send: Send
 

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.

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.

+Pie Number of slices to send: Send
 

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..
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
 

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



Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5866 times.
Similar Threads
Do I need synchronization here ?
Static Initializer / methoed
Linked List Sorting Problem
Collections/Generics
programmatic HTmlCommandLink action with parameters not working
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:43:07.