Page 1 of 1

About Question enthuware.ocpjp.i.v11.2.3071 :

Posted: Wed Jun 05, 2019 3:28 pm
by kevvvvyp
Hi there,

I think the following question in the 1Z0-851 exam is incorrect, the correct answer is listed as "Compilation error at //2" but this should be Compilation error at //1" ?

Q: What will the following code print when compiled and run?

Code: Select all

    public static void main(String args[]) {


        int value = 0;
        Supplier<Integer> valueS = () -> value++; //1
        value++; //2
        System.out.println(value + " " + valueS.get()); //3
    }

Re: About Question enthuware.ocpjp.i.v11.2.3071 :

Posted: Thu Jun 06, 2019 12:04 am
by admin
Yes, you are right. The error should be at //1. Fixed.
thank you for your feedback!
Paul.