This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, need some help here. i have to convert a double into integer and use it to set my JScrollBar. Since JScrollBar dosen't take a double i've use this method ScrollBar.setValue(value.intValue()) and this is the error double cannot be dereferenced Help!
You can't call methods on primitive types like double, or int, float, long, short, byte, char, or boolean. You might be confusing double with java.lang.Double, which is a a class which does indeed have an intValue() method. But a double is not a Double. Anyway, if you have a value of type double and you need a value of type int, you can use a cast:
Note that fractions will be truncated towards zero; if your double is between 0 and 1, then casting it to an int will give you 0.