vendredi 29 juillet 2016

Android double not working

I'm having this strange issue with android studio when i print a double value such as 1/4 like :

double test = 1/4
System.out.println(test);

//the output is 0.0

When i am calculating score which is ((correct_ans/MAXIMUM_CHANCE)*RANGE) it also calculates answer as 0.0, where correct_ans, MAXIMUM_CHANCE and RANGE are all integers. This is then shown on my Text View using ""+score. What am i doing wrong ?

Aucun commentaire:

Enregistrer un commentaire