According to the docs, I can do this:
SocketChannel mySocketChannel = new SocketChannel(SelectorProvider.provider());
According to JDK I can not.
Simple question: Why am I getting the error in the title?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The constructor is
protected, meaning only inherited classes can access it to inherit its base functionality (notice thatSocketChannelinherits fromAbstractSelectableChannel).To open a
SocketChannel, use the staticopenmethod:See the SocketChannel Documentation and an example.