aspose file tools*
The moose likes Beginning Java and the fly likes Constructor undefined error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor undefined error" Watch "Constructor undefined error" New topic
Author

Constructor undefined error

mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72
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
Sheriff

Joined: Sep 28, 2004
Posts: 18992
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

you mean line 24??


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Harpreet Singh janda
Ranch Hand

Joined: Jan 14, 2010
Posts: 317

Can you please post the class MSS's code?
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

yup! put the coding of class MSS!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Aditya Kanitkar
Ranch Hand

Joined: Aug 08, 2009
Posts: 72
@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

Joined: Aug 16, 2005
Posts: 14349
    
  22

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39855
    
  28
Please avoid everybody saying the same thing several times.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Oct 13, 2005
Posts: 39855
    
  28
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

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Dec 30, 2008
Posts: 72
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
Sheriff

Joined: Sep 28, 2004
Posts: 18992
    
  40

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

Joined: Dec 30, 2008
Posts: 72
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


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructor undefined error