About Question enthuware.ocpjp.v11.2.3641 :
Posted: Fri May 03, 2024 6:48 am
Hello
I know it's not within the context of the question, but I wanted to write to find out if I'm wrong or not.
In the following code, it appears that the lambda expression is typed incorrectly, is this correct?
Both lines after the lamda expression belong to the lamda expression? So shouldn't I have a key?
And if this were not the case, if only the first line belongs to the lambda, which I do not think is the case, then the ; at the end of the expression it would not be bad.
Thanks in advance for responding
I know it's not within the context of the question, but I wanted to write to find out if I'm wrong or not.
In the following code, it appears that the lambda expression is typed incorrectly, is this correct?
Code: Select all
public void invokeService(String srvname, String host, int port){
...
Socket socket = null;
try{
AccessController.doPrivileged( ( PrivilegedExceptionAction<Void> ) ()->
socket = new Socket(host, port);
return null;
}
...
}
And if this were not the case, if only the first line belongs to the lambda, which I do not think is the case, then the ; at the end of the expression it would not be bad.
Thanks in advance for responding