Java Magazine, Nov/Dec 2017
ORACLE COM JAVAMAGAZINE NOVEMBER DECEMBER 2017 94 fix this E Given the information available its not possible to guarantee that the removal will succeed Question 4 advanced Given the following code Optional String ofNullable null flatMap x x null Optional of A Optional of B map String toLowerCase ifPresent System out println Which is true Choose one A The output is a B The output is b C Replacing the flatMap call with orElseGet Optional of C results in the output c D The code runs but produces no output E Replacing the call to flatMap with map x x null A B results in the output b Answers Question 1 The correct answer is option D This question investigates an obscure corner of Javas numeric literal syntax For reasons that are largely historical Java supports the octal base 8 number system In this system you would count to 10 as 1 2 3 4 5 6 7 10 11 12 The system uses only eight digits 0 through 7 After reaching 7 it sets the first column to 0 and increments the next column going from 7 to 10 pronounced one zero not ten in the same way that the familiar base 10 system goes from 9 to 10 However a critical diference is
You must have JavaScript enabled to view digital editions.