Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2008, 08:03 PM
Member
 
Join Date: Apr 2008
Posts: 2
MattyB is on a distinguished road
Errors I don't understand
Hey i'm creating an insurance application in Netbeans and the class containing the clients details looks like this
Code:
package insurancecompany; public class ClientDetails { private String clientID; public Name clientName; private Address clientAddress; private PolicyList clientPolicies; public ClientDetails(String ClientID, Name clientName, Address clientAddress, PolicyList clientPolicies) { this.clientID = id; this.clientName = name; this.clientAddress = address; this.clientPolicies = policies; } public String getID() { return id; } public Name getName() { return name; } public Address getAddress() { return address; } public Policies getPolicies() { return policies; } public String toString(){ return "\tID: " + id + ";\t" + "name: " + name + ";\t" + "address: " + address + ";\t" + "policies: " + policies + ""; } }
:

I am however getting errors being flagged up for every line except private String clientID.

The error says "cannot find symbol"

Can anyone shed any light on the problem?

Cheers
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-01-2008, 09:40 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Within the package insurancecompany, do the Name, Address and Policies etc, class/type exist ? Make sure they're apart of this package. Post a couple of those source files too if you want.

"cannot find symbol" is the Java way of telling you it can't find the types specified in your source code.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-01-2008, 09:48 PM
Member
 
Join Date: Apr 2008
Posts: 2
MattyB is on a distinguished road
thanks for the reply.

here are a couple of the other classes

Address
Code:
package insurancecompany; import java.lang.Comparable; /* * Address.java * * Created on 27 March 2008, 13:59 * * * @author Matthew Butterfant */ public class Address implements Comparable<Address> { private String street; private String towncity; private String postcode; public int compareTo(Address other) { int result; if (street.compareTo(towncity) < 0) result = -1; else if (towncity.compareTo(other.towncity) == 0) result = street.compareTo(other.street); else result = 1; return result; } public String toString(){ return street + " " + towncity + " " + postcode; } }
Name:
Code:
package insurancecompany; import java.util.*; /* * Name.java * * Created on 27 March 2008, 13:59 * * @author Matthew Butterfant */ class Name { private String title; private String initials; private String surname; public String getTitle() { return title; } public String getInitials() { return initials; } public String getSurname() { return surname; } public String toString() { return title + " " + initials + " " + surname; } }
Thanks
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-01-2008, 09:55 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
You might wish to change your Name class access to public.

Everything looks ok syntactically.... unless I missed something. I don't have the capacity to test your code right now as I'm at work and on lunch break. If someone can't solve this for you by the time I get out, I'll have a look at it then.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-02-2008, 01:55 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
In ClientDetails, you've mismatched variables all over. You try to return variables in the getters but these do not exist. Compare the variables you're trying to return in your getters to those variables that actually exist at the class's scope. For example: return id; ?? you can't because the proper identifier is clientID, same goes for the constructor.

You can't use the '+' operator in a toString(), thus you to get the same functionality you're wishing to achieve, look into using StringBuilder.

Best of luck, and post back with any further questions.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
help me need to understand queries hossainsadd Database 1 05-26-2008 02:02 AM
help with these errors oceansdepth New To Java 3 04-16-2008 06:55 PM
i don understand this error Deon New To Java 4 01-12-2008 12:03 PM
I have 3 errors after compiling coco Database 2 10-18-2007 11:32 AM
Errors in constructor ai_2007 Advanced Java 0 07-01-2007 07:35 PM


All times are GMT +3. The time now is 04:55 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org