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?
About Question enthuware.ocpjp.v8.2.2024 :
Moderator: admin
-
- Posts: 4
- Joined: Sat Mar 05, 2016 2:15 pm
- Contact:
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.2024 :
But we are not dividing by zero anywhere in this code.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 37 guests