Home > Archive > Java Help > May 2004 > cannot resolve symbol constructor please help new to Java
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
cannot resolve symbol constructor please help new to Java
|
|
| luh3417 2004-05-18, 1:32 pm |
| I have 3 classes one parent class and 2 child classes both the child
classes have 1 error C:\MarkedModule.java:11: cannot resolve symbol
symbol : constructor Modules ()
location: class Modules
{
this is the part of the code with error for one of my child classes-
public class MarkedModule extends Modules
{
private int weight1;
private int weight2;
private int mark1;
private int mark2;
public MarkedModule(int newWeight1, int newWeight2)
{
weight1 = newWeight1;
weight2 = weight2 = weight1 -100;
mark1 = 0;
mark2 = 0;
}
and this is part of my code for the parent class -
public abstract class Modules
{
private String code;
private String title;
private int credits;
private int level;
protected boolean submitted;
public Modules(String newCode, String newTitle, int newCredits, int
newLevel)
{
code = newCode;
title = newTitle;
credits = newCredits;
level = newLevel;
submitted = false;
}
I am very new to java can anyone help me??? I will really apreciate it
i have been stuck on this for a w . Thankyou loads :)
| |
|
| In article <84258db8.0405180827.1c1c7fb@posting.google.com>,
sarah@tatooine.co.uk enlightened us with...
> I have 3 classes one parent class and 2 child classes both the child
> classes have 1 error C:\MarkedModule.java:11: cannot resolve symbol
> symbol : constructor Modules ()
<I think...>
It's looking for a constructor that takes no arguments for the implicit
call to super() done by child classes. You did not provide such a
contructor in that class (Modules).
In the Modules class, you need the default constructor with no arguments
defined. OR you need to actually call super() with the proper number of
arguments in the child classes.
--
--
~kaeli~
Synonym: the word you use in place of a word you can't
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
| |
| Ryan Stewart 2004-05-18, 10:32 pm |
| "kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1b140af75dfbd521989e54@nntp.lucent.com...
> In article <84258db8.0405180827.1c1c7fb@posting.google.com>,
> sarah@tatooine.co.uk enlightened us with...
>
> <I think...>
>
> It's looking for a constructor that takes no arguments for the implicit
> call to super() done by child classes. You did not provide such a
> contructor in that class (Modules).
>
> In the Modules class, you need the default constructor with no arguments
> defined. OR you need to actually call super() with the proper number of
> arguments in the child classes.
>
Correct. When using inheritance, you must either:
1) have a default constructor in the super class,
2) for each constructor in a sub class, have a constructor with the same
signature in the super class, or
3) within any constructor in a sub class that does not correspond (by
signature) to a constructor in the super class, call a constructor in the
super class with super(...).
|
|
|
|
|