About Question enthuware.ocpjp.v8.2.2024 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
philcave
Posts: 4
Joined: Sat Mar 05, 2016 2:15 pm
Contact:

About Question enthuware.ocpjp.v8.2.2024 :

Post 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?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

But we are not dividing by zero anywhere in this code.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests