Quiz

Complete this quiz to test your understanding of error handling.

1

What is the output of the code below?

Observable<Integer> observable =
         Observable.range(0, 10).flatMap(i -> {
            return (i == 3)
                ? Observable.error(new Exception("An error occurred"))
                : Observable.just(i);
        });
        observable.subscribe(i -> {
        }, throwable -> {
            System.out.println("onError(): " + throwable.getMessage());
        }); 
A)

3

B)

3
onError(): An error occurred.

C)

0
1
2

D)

onError(): An error occurred.

Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.