What is the result?

Given the code fragment:
String str = “Java is a programming language”;
ToIntFunction<String> indexVal = str: : indexOf; //line n1
int x = indexVal.applyAsInt(“Java”); //line n2
System.out.println(x);
What is the result?
A. 0
B. 1
C. A compilation error occurs at line n1.
D. A compilation error occurs at line n2.

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “What is the result?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.