Print out object that is in a tree
I am trying to print out the object in a tree. I have a toString method defined for the object. However, I get this error:
I get a classCastException
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LPriorityQueueNode;
at PriorityQueue.printPriorityQueue(PriorityQueue.jav a:49)
at driver.main(driver.java:63)
Code :
System.out.println( tree[0].getElement());
Re: Print out object that is in a tree
I think it returns a Node object
try
getElementName() or getElementValue()
to get the name n value of node,I m not sure weather it works or not
Regards
Sai