0

Operadores primitivos, en una división debemos poner float o double

en uno de los ejercicios de la app aparece int x=15 e int=4,y el resultado como int= result, en el resultado debes ser como un tipo de carácter que reciba tanto entero como decimal

27th Oct 2017, 3:41 AM
Alex RaGa
Alex RaGa - avatar
1 Antwort
+ 1
If you're only using ints you should declare the result as an int also. If you're working with both, floats/doubles and ints you should declare it as a float/double otherwise you would've to make a cast and in some cases that leads to loss of information, for example: int result = (int) 2.6; System.out.println(result); //This will print 2, so you can see it not even ceelling or flooring the number it just gets the intenger part! In conclusion you should always declare the result as the primitive type more abrangent that you're working with.
27th Oct 2017, 7:27 AM
Chriptus13
Chriptus13 - avatar