View Single Post
  #2 (permalink)  
Old 07-04-2007, 06:59 AM
Marcus Marcus is offline
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
What this means is, at runtime, java cannot convert from class Object to class Items. What I would do, is use the constructor in the Items class to accept your string value and use that to create your Items object.

Code:
String itemString = itemToUse.nextLine(); Items item = new Items(itemString);
This would avoid the nasty type casting and in my opinion provide cleaner code. I don't know how practical this is for you, as I don't know what your Items class looks like.

Greetings.

Marcus
Reply With Quote