get the wrong answer for divide in Java [duplicate]

I'm a newbie in Java. this is a part of my program. i should get a 0.65 as a result but java result is 0.0. how to solve it?

    double xinc;
    int dx = 190;
    int len = 290;
    xinc = dx/len;
    System.out.println(xinc);

Solution 1:

int/int = int

You have to make dx and len as double in order to get a double result else you can also type cast dx and len to double.

Solution 2:

Try this:

xinc = (double)dx/len;

Also, before posting, Google.

int / int = int
int / double = double
double / int = double