Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Undefined constructor for the super class.

Reply
Thread Tools

Undefined constructor for the super class.

 
 
TheTravellingSalesman
Guest
Posts: n/a
 
      09-03-2007
I'm using eclipse to write my java program.

I am writing a class call it Node2 which extends Node1

The only difference is that Node1 has a constructor that take (double,
String, double) as parameters and it works absolutely fine <-- as I
tested node1.

However, when writing the node2's constructor, I have the following

================================================== ===================

//The only difference between the two nodes is that Node 2 take an
additional vector as input.

public Node2 (double a1, String a2, double a3, Vector otherNodes)
{ super(a1,a2,a3);
this.nextNodes = otherNodes;
}
// the problem comes in line where I'm calling super because the
compiler (eclipse 3.2.2.) does not recognize super constructor of
node1.it says that the

"constructor (double, String, double) is undefined".

================================================== ====================

Any idea what I'm doing wrong or why would something like this
happen?

Any help is appreciated

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Arne_Vajh=F8j?=
Guest
Posts: n/a
 
      09-03-2007
TheTravellingSalesman wrote:
> I am writing a class call it Node2 which extends Node1
>
> The only difference is that Node1 has a constructor that take (double,
> String, double) as parameters and it works absolutely fine <-- as I
> tested node1.
>
> However, when writing the node2's constructor, I have the following


> //The only difference between the two nodes is that Node 2 take an
> additional vector as input.
>
> public Node2 (double a1, String a2, double a3, Vector otherNodes)
> { super(a1,a2,a3);
> this.nextNodes = otherNodes;
> }
> // the problem comes in line where I'm calling super because the
> compiler (eclipse 3.2.2.) does not recognize super constructor of
> node1.it says that the
>
> "constructor (double, String, double) is undefined".
>
> ================================================== ====================
>
> Any idea what I'm doing wrong or why would something like this
> happen?


May we see class declaration and all constructors for both classes ?

Arne
 
Reply With Quote
 
 
 
 
SadRed
Guest
Posts: n/a
 
      09-03-2007
On Sep 3, 11:10 am, TheTravellingSalesman <(E-Mail Removed)>
wrote:
> I'm using eclipse to write my java program.
>
> I am writing a class call it Node2 which extends Node1
>
> The only difference is that Node1 has a constructor that take (double,
> String, double) as parameters and it works absolutely fine <-- as I
> tested node1.
>
> However, when writing the node2's constructor, I have the following
>
> ================================================== ===================
>
> //The only difference between the two nodes is that Node 2 take an
> additional vector as input.
>
> public Node2 (double a1, String a2, double a3, Vector otherNodes)
> { super(a1,a2,a3);
> this.nextNodes = otherNodes;
> }
> // the problem comes in line where I'm calling super because the
> compiler (eclipse 3.2.2.) does not recognize super constructor of
> node1.it says that the
>
> "constructor (double, String, double) is undefined".
>
> ================================================== ====================
>
> Any idea what I'm doing wrong or why would something like this
> happen?
>
> Any help is appreciated


It should compile normally if your code is properly written.
We may need to see a small example code that shows the problem.

 
Reply With Quote
 
TheTravellingSalesman
Guest
Posts: n/a
 
      09-03-2007
Here's the constructor for Node1

public Node1(double a, String b, double c)
{
this.nodePot = a;
this.Name = b;
this.rate = c;
}


And for the class for "Node2 extends Node1"

I have two Nodes which are extending Node1. While one of them works,
this one (i.e. Node2) doesn't work and I have no idea why. Same line
of code. I'm running them in the same project. Unless, I'm forgetting
to import something. If any of you guys want to see the exact lines of
entire classes, I can email them........although I've posted the
constructor above with the changed variable names......











On Sep 2, 10:39 pm, SadRed <(E-Mail Removed)> wrote:
> On Sep 3, 11:10 am, TheTravellingSalesman <(E-Mail Removed)>
> wrote:
>
>
>
> > I'm using eclipse to write my java program.

>
> > I am writing a class call it Node2 which extends Node1

>
> > The only difference is that Node1 has a constructor that take (double,
> > String, double) as parameters and it works absolutely fine <-- as I
> > tested node1.

>
> > However, when writing the node2's constructor, I have the following

>
> > ================================================== ===================

>
> > //The only difference between the two nodes is that Node 2 take an
> > additional vector as input.

>
> > public Node2 (double a1, String a2, double a3, Vector otherNodes)
> > { super(a1,a2,a3);
> > this.nextNodes = otherNodes;
> > }
> > // the problem comes in line where I'm calling super because the
> > compiler (eclipse 3.2.2.) does not recognize super constructor of
> > node1.it says that the

>
> > "constructor (double, String, double) is undefined".

>
> > ================================================== ====================

>
> > Any idea what I'm doing wrong or why would something like this
> > happen?

>
> > Any help is appreciated

>
> It should compile normally if your code is properly written.
> We may need to see a small example code that shows the problem.



 
Reply With Quote
 
TheTravellingSalesman
Guest
Posts: n/a
 
      09-03-2007
It is usually the String class that gives me trouble. For instance, in
the contructors, where I'm using string, it says, the consturctor is
not same. Some places its giving me errors like "+=" operator is
undefined for type String..


even thought I have imported java.lang.*; its still giving me the
problems. ANy suggestions/ideas. Could it be my compiler or something
I haven't installed/added in?






On Sep 2, 10:50 pm, TheTravellingSalesman <(E-Mail Removed)>
wrote:
> Here's the constructor for Node1
>
> public Node1(double a, String b, double c)
> {
> this.nodePot = a;
> this.Name = b;
> this.rate = c;
>
> }
>
> And for the class for "Node2 extends Node1"
>
> I have two Nodes which are extending Node1. While one of them works,
> this one (i.e. Node2) doesn't work and I have no idea why. Same line
> of code. I'm running them in the same project. Unless, I'm forgetting
> to import something. If any of you guys want to see the exact lines of
> entire classes, I can email them........although I've posted the
> constructor above with the changed variable names......
>
> On Sep 2, 10:39 pm, SadRed <(E-Mail Removed)> wrote:
>
> > On Sep 3, 11:10 am, TheTravellingSalesman <(E-Mail Removed)>
> > wrote:

>
> > > I'm using eclipse to write my java program.

>
> > > I am writing a class call it Node2 which extends Node1

>
> > > The only difference is that Node1 has a constructor that take (double,
> > > String, double) as parameters and it works absolutely fine <-- as I
> > > tested node1.

>
> > > However, when writing the node2's constructor, I have the following

>
> > > ================================================== ===================

>
> > > //The only difference between the two nodes is that Node 2 take an
> > > additional vector as input.

>
> > > public Node2 (double a1, String a2, double a3, Vector otherNodes)
> > > { super(a1,a2,a3);
> > > this.nextNodes = otherNodes;
> > > }
> > > // the problem comes in line where I'm calling super because the
> > > compiler (eclipse 3.2.2.) does not recognize super constructor of
> > > node1.it says that the

>
> > > "constructor (double, String, double) is undefined".

>
> > > ================================================== ====================

>
> > > Any idea what I'm doing wrong or why would something like this
> > > happen?

>
> > > Any help is appreciated

>
> > It should compile normally if your code is properly written.
> > We may need to see a small example code that shows the problem.



 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      09-03-2007
TheTravellingSalesman wrote:
> It is usually the String class that gives me trouble. For instance, in
> the contructors, where I'm using string, it says, the consturctor is
> not same. Some places its giving me errors like "+=" operator is
> undefined for type String..


Which is strange, since that operator is defined for type String.

> even thought I have imported java.lang.*; its still giving me the


You never need to import java.lang.*. The language imports that for you
regardless.

> problems. ANy suggestions/ideas. Could it be my compiler or something
> I haven't installed/added in?


People have suggested that you post an example. Until you do, we're helpless
to help.

The example should be complete. The fragmentary approach leaves out the part
of the code that has the problem.

--
Lew
 
Reply With Quote
 
GArlington
Guest
Posts: n/a
 
      09-03-2007
On 3 Sep, 06:30, TheTravellingSalesman <(E-Mail Removed)> wrote:
> It is usually the String class that gives me trouble. For instance, in
> the contructors, where I'm using string, it says, the consturctor is
> not same. Some places its giving me errors like "+=" operator is
> undefined for type String..
>
> even thought I have imported java.lang.*; its still giving me the
> problems. ANy suggestions/ideas. Could it be my compiler or something
> I haven't installed/added in?
>
> On Sep 2, 10:50 pm, TheTravellingSalesman <(E-Mail Removed)>
> wrote:
>
> > Here's the constructor for Node1

>
> > public Node1(double a, String b, double c)
> > {
> > this.nodePot = a;
> > this.Name = b;
> > this.rate = c;

>
> > }

>
> > And for the class for "Node2 extends Node1"

>
> > I have two Nodes which are extending Node1. While one of them works,
> > this one (i.e. Node2) doesn't work and I have no idea why. Same line
> > of code. I'm running them in the same project. Unless, I'm forgetting
> > to import something. If any of you guys want to see the exact lines of
> > entire classes, I can email them........although I've posted the
> > constructor above with the changed variable names......

>
> > On Sep 2, 10:39 pm, SadRed <(E-Mail Removed)> wrote:

>
> > > On Sep 3, 11:10 am, TheTravellingSalesman <(E-Mail Removed)>
> > > wrote:

>
> > > > I'm using eclipse to write my java program.

>
> > > > I am writing a class call it Node2 which extends Node1

>
> > > > The only difference is that Node1 has a constructor that take (double,
> > > > String, double) as parameters and it works absolutely fine <-- as I
> > > > tested node1.

>
> > > > However, when writing the node2's constructor, I have the following

>
> > > > ================================================== ===================

>
> > > > //The only difference between the two nodes is that Node 2 take an
> > > > additional vector as input.

>
> > > > public Node2 (double a1, String a2, double a3, Vector otherNodes)
> > > > { super(a1,a2,a3);
> > > > this.nextNodes = otherNodes;
> > > > }
> > > > // the problem comes in line where I'm calling super because the
> > > > compiler (eclipse 3.2.2.) does not recognize super constructor of
> > > > node1.it says that the

>
> > > > "constructor (double, String, double) is undefined".

>
> > > > ================================================== ====================

>
> > > > Any idea what I'm doing wrong or why would something like this
> > > > happen?

>
> > > > Any help is appreciated

>
> > > It should compile normally if your code is properly written.
> > > We may need to see a small example code that shows the problem.


Did you manage to override String class somewhere? Defined it
yourself???

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
super.super.super how? Java 24 02-24-2005 10:51 PM
super. could there be a simpler super? Kerim Borchaev Python 4 01-15-2004 03:15 PM
WHICH LENS? - SIGMA 70-300mm DL MACRO Super-II or 28-300mm AF Super Zoom 4 - for Canon 300d Rebel Digital SLR? No Spam Digital Photography 24 11-27-2003 08:21 AM
Getting the super class via the super() function Fernando Rodriguez Python 2 11-22-2003 12:08 AM



Advertisments