Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / May 2004

Tip: Looking for answers? Try searching our database.

cannot resolve symbol constructor please help new to Java

Thread view: 
luh3417 - 18 May 2004 17:27 GMT
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 week. Thankyou loads :)
kaeli - 18 May 2004 18:59 GMT
> 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.

Signature

--
~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 - 19 May 2004 02:49 GMT
> > 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
[quoted text clipped - 9 lines]
> 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(...).


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.