Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > Java

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-23-2009, 10:48 AM
tking88 tking88 is offline
Registered User
 
Join Date: Oct 2009
Posts: 3
What is Instance, Empty Constructor ....

K I did something like this and all ok now it return the true compare value

Code:
public boolean equals(Object o)
{
System.out.println(o instanceof Moof);
System.out.println(((Moof)o).getMoofValue());
System.out.println(this.moofValue); //XXX
if ((o instanceof Moof) && (((Moof)o).getMoofValue() == this.moofValue))
{
return true;
}
else
{
return false;
}

Last edited by tking88; 10-24-2009 at 11:35 AM.
Reply With Quote
  #2  
Old 10-23-2009, 09:21 PM
nspils nspils is offline
Senior Member
 
Join Date: Dec 2004
Location: San Bernardino County, California
Posts: 1,455
Have you overridden the "equals" method of Object to allow your teacher instances to compare themselves? The instances are not the same and that is what the "equals" method is returning to you. YOu must define the state of your objects.
Reply With Quote
  #3  
Old 10-23-2009, 09:43 PM
tking88 tking88 is offline
Registered User
 
Join Date: Oct 2009
Posts: 3
Check top post is the solution of overridding equal

Last edited by tking88; 10-24-2009 at 11:35 AM.
Reply With Quote
  #4  
Old 10-24-2009, 10:44 AM
nspils nspils is offline
Senior Member
 
Join Date: Dec 2004
Location: San Bernardino County, California
Posts: 1,455
How do you compare String objects? You cannot use "==". There is a method of the String class which compares one String with another.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a GUI to run Eric Java 4 04-14-2006 10:09 AM
Getting a GUI to function Eric Java 1 11-27-2001 07:53 AM
Passing Data to another instance of an application Michael Lambino VB Classic 12 06-14-2001 03:19 PM
Significance of System.EventArgs? Paul Mc .NET 5 06-06-2001 06:10 PM
using the "this" method in a constructor Mike Java 3 04-13-2001 10:13 PM


All times are GMT -4. The time now is 11:16 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.