How do I cast a double to an int in Java?

java

Solution

`double` is not an object, it is a primitive type.

Simply writing `(int)b` will do the job.

If you really need a `Double` object, you need to construct one.

Problem

I'm looking at http://docs.oracle.com/javase/6/docs/api/java/lang/Double.html I am trying ``` double b = Math.sqrt(absoluteNumber); int c = b.intValue(); ``` but I am getting this error: ``` Factorise.java:13: error: double cannot be dereferenced int c = b.intValue(); ``` Help please?

Original source

Related problems