Would you please look at my code?
public class Data
{
public double x;
public double y;
public Data(double x,double y)
{
this.x=x;
this.y=y;
}
public String toString()
{
return String.format(" %.2f %.2f\n", x,y);
}
}
We insert these pair numbers into a linked list, then remove them.
Object removeObject = list1.removeFromFront();
Double d = (Double)removeObject.x;
Here a warn alert:
cannot find symbol x
Thanks
ardy,
the above replies are spot on for a fix to the immediate problem... but if you're on java 1.6 or even 1.5 then you really need to bone up on collections and generics.
Start with [url=http://72.5.124.55/docs/books/tutorial/collections/index.html]Sun's java tut' on collections[/url], and the javaworld one is also worth the time.
It'll probably take you a couple of evenings to get through it.... but it'll save you days, weeks, and months of future headaches.
I'm a huge fan of generics.
keith.