I'm not really sure whether you're talking about objects (Double and Integer) or primitive datatypes (double and int). But here's a short program which illustrates both.
The important things here are - to cast to an int, you need to put (int) before the double you want to cast to an int. And to get the int value of a Double object, you can use the intValue() method of the Double object. Hope this helps, Kathy
Use the wrapper classes. Converting primatives is much easier if you move them into the wrapper classes. Here's an example of how to do so Double MyDoubleObject = new Double(1.002); Integer MyIntegerObject = new Integer((MyDoubleObject.intValue())); System.out.println(MyIntegerObject.toString());
By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Joined: Jan 15, 2001
Thanks guys. However, Kathy your solution is more along the lines of what I was looking for.