Java Magazine, May/June 2018
ORACLE COM JAVAMAGAZINE MAY JUNE 2018 98 fix this right is a method name or the keyword new An object identity can be any expression that results in a single object and a class name might be fully qualified So sometimes theres an expression or package dot syntax on the left of the double colon but none of these variations allows two sets of double colons to be strung together in the way shown in option A As a result option A is incorrect In option C the form Converter inc could match either a static method in the Converter class or an instance method in that class if the method is called inc However no such static method exists and for the instance method form the first argument to the lambda would have to be of type Converter However in this stream code the map operation requires a Function T U where T the first argument to the lambda is the type of the stream data In this code the stream contains Integer objects not Converter objects As a result you can determine that option C is also incorrect Option D proposes a syntax that involves parentheses after the method name in the reference No such syntax exists and therefore option D is incorrect In option B everything works as needed The map method requires a Function T U where T is the upstream data type Integer in this case and U defines the downstream type after the map operation also Integer in this case Because c is an instance of Converter the syntax c inc is of form 4 Therefore it translates to x c inc x This fits the required form Function Integer Integer and therefore option B is correct article Simon Roberts joined Sun Microsystems in time to teach Suns first Java classes in the UK He created the Sun Certified Java Programmer and Sun Certified Java Developer exams He wrote several Java certification guides and is currently a freelance educator who publishes recorded and live video training through Pearson InformIT available direct and through the OReilly Safari Books Online service He remains involved with Oracles Java certification projects Mikalai Zaikin is a lead Java developer at IBA IT Park in Minsk Belarus During his career he has helped Oracle with development of Java certification exams and he has been a technical reviewer of several Java certification books including three editions of the famous Sun Certified Programmer for Java study guides by Kathy Sierra and Bert Bates
You must have JavaScript enabled to view digital editions.