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 / General / November 2005

Tip: Looking for answers? Try searching our database.

Can't find constructor.

Thread view: 
tolu45 - 04 Nov 2005 15:02 GMT
Hi,

I have some problems with my java code. I Have 2 class SelGraphNode and
SelGraph. Both have constructors. The problems is when i instantiate
Node in SeleGraph,I get an error saying:
Can't find symbol
Symbol: Constructor SelGraphNode
Find Below the code for the 2 constructors:

for SelGraph:

public class SelGraph {

   SelGraphNode nodes = new SelGraphNode();
   //SelGrapNode node1 = new SelGrapNode();
   ArrayList<SelGraphEdge> edgesList = new ArrayList<SelGraphEdge>();
   ArrayList<SelGraphNode> nodesList = new ArrayList<SelGraphNode>();
   //Vector edges = new Vector();
   Vector table_list = new Vector();
   Vector condition_list = new Vector();
   Vector join_list = new Vector();

   /** Creates a new instance of SelGraph */
   public SelGraph(SelGraphNode N,SelGraphEdge E) {
   nodes = N;
       }

complete code for SelGraphNode() :

public class SelGraphNode {

           public String table_name = new String();
           public Vector condition = new Vector();
           public boolean node_flag;
           public String primary_key = new String();

   /** Creates a new instance of SelGrapNode */
   public SelGraphNode(String table_name, Vector condition, boolean
node_flag, String primary_key) {
       this.table_name = table_name;
       this.condition = condition;
       this.node_flag = node_flag;
       this.primary_key = primary_key;
   }

           public String getTableName () { return table_name; }
           public Vector getCondition () { return condition; }
           public boolean getNodeFlag () { return node_flag;}
           public String getPrimaryKey () { return primary_key; }

}

Your help will be appreciated
Roedy Green - 04 Nov 2005 15:10 GMT
>Can't find symbol
>Symbol: Constructor SelGraphNode
>Find Below the code for the 2 constructors:

What is the code that got the error message?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

tolu45 - 04 Nov 2005 15:30 GMT
the selection graph code. Besides when i tried to instantiate the
selGraph class, I got the same message. This was how i instantiated
it:SelGraph selGraph1 = new SelGraph(new SelGraphNode("movie", "",
true, "id"));
chris_k - 04 Nov 2005 15:34 GMT
Hi,

You are missing to explicitly provide the default no-args constructor
of class SelGraphNode

HTH,
chris
tolu45 - 04 Nov 2005 16:01 GMT
I have added  that still it doesn't work
Joan - 04 Nov 2005 17:26 GMT
> Hi,
>
> You are missing to explicitly provide the default no-args
> constructor
> of class SelGraphNode

not required

> HTH,
> chris
zero - 04 Nov 2005 15:46 GMT
> Hi,
>
[quoted text clipped - 10 lines]
>
>     SelGraphNode nodes = new SelGraphNode();

This is your problem.  You're calling a constructor without arguments,
but...

>     //SelGrapNode node1 = new SelGrapNode();
>     ArrayList<SelGraphEdge> edgesList = new ArrayList<SelGraphEdge>();
[quoted text clipped - 26 lines]
>         this.primary_key = primary_key;
>     }

...SelGraphNode only has a constructor with 4 arguments.  Add a
no-argument constructor.  Or just remove the new SelGraphNode() part, as
variable nodes is instantiated in the constructor anyway.

Also, you're mixing typed collections (ArrayList<SelGraphEdge>
edgesList) with raw collections(Vector table_list).  What's the
reasoning behind that?


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



©2009 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.