Results 1 to 3 of 3
Thread: Type Casting Help
- 02-07-2008, 12:23 AM #1Member
- Join Date
- Jan 2008
- Rep Power
Type Casting Help
I believe this is a problem with Type casting but I am not sure. I have a LinkedList class that I have created which stores nodes of type Object. I am building a print queue that uses the list and stores an Object of type printdata in the nodes. This line of code here gives me the following error message:
Type mismatch: cannot convert from Object to PriorityQ.printdata
printdata temp = L1.getNode(0);
I assume that I need to type cast but I don't know how.
- 02-07-2008, 01:52 AM #2
stores an Object of type printdata
Try declaring/adding this "printdata" as the type instead of Object.
LinkedList<printdata> list = ...
- 02-07-2008, 01:06 PM #3
- By kurtulas in forum New To JavaReplies: 2Last Post: 02-16-2008, 09:03 PM
- By ajaygargnsit in forum Advanced JavaReplies: 4Last Post: 01-04-2008, 05:54 PM
- By ajaygargnsit in forum New To JavaReplies: 1Last Post: 12-22-2007, 02:05 PM
- By leebee in forum New To JavaReplies: 5Last Post: 08-10-2007, 01:24 PM
- By Marcus in forum New To JavaReplies: 1Last Post: 07-05-2007, 07:28 AM