Page 1 of 1

About Question enthuware.ocpjp.v8.2.2024 :

Posted: Sat Dec 07, 2019 7:37 am
by philcave
DoubleStream is = DoubleStream.of(0, 2, 4); //1
double sum = is.filter( i->i%2 != 0 ).sum(); //2
System.out.println(sum); //3

Why doesn't this give an ArithmeticException when the modulus operation tries to divide 0 by 2?

Re: About Question enthuware.ocpjp.v8.2.2024 :

Posted: Sat Dec 07, 2019 9:03 am
by admin
But we are not dividing by zero anywhere in this code.