Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Exception in thread "main" java.lang.ClassCastException

Reply
Thread Tools

Exception in thread "main" java.lang.ClassCastException

 
 
ghashami_mina
Guest
Posts: n/a
 
      12-24-2007
Hi,
i have a problem and i need your help
please help me
i get this exception: Exception in thread "main" java.lang.ClassCastException: java.awt.Color cannot be cast to java.lang.Comparable

and my program is :
import java.awt.Color;
import java.util.TreeMap;


public class Street extends buyable{

int[] rent = new int[5];
int rent_hotel;
Color color;
int buildCost;
int sellPrice;
static TreeMap <Color,Integer> numOfHouse = new TreeMap<Color,Integer>();
int numberOfHouse=0;
int numberOfHotel=0;


public Street(String name,int number,int mortValue,int price,int rent0,int rent1,int rent2,int rent3,int rent4,int rent_hotel,int buildCost,Color color) {
super(name, number, mortValue, price);
rent[0] = rent0;
rent[1] = rent1;
rent[2] = rent2;
rent[3] = rent3;
rent[4] = rent4;
this.rent_hotel = rent_hotel;
this.color = color;
this.buildCost = buildCost;
this.sellPrice = buildCost / 2;
numOfHouse.put(color ,new Integer(0));
}

public static void main(String[] args) {
Street m = new Street("mian",43,4,3,1,2,3,4,5,6,7,Color.pink);
Integer a= m.numOfHouse.get(Color.pink);
}
}
what should i do to solve this problem?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Terminating a thread from the main thread Charles A. Lackman ASP .Net 3 12-09-2004 02:12 PM
"Thread was being aborted" error from WebApp using Thread.Sleep. Stephen Miller ASP .Net 3 07-01-2004 11:50 PM
perl 5.8.2/3 - thread started by a thread pawo Perl 0 02-16-2004 01:18 PM



Advertisments