0

The question is not about creating normal arrays. Kindly provide me with an example of how to create array of selectors in java nio. The following code throws nullpointerexception

Selector [] selectors; selectors[0] = Selector.open();

Aditya
  • 1
  • 1
  • Is this about NIO selectors or CSS selectors. They are completely different things!! – Stephen C Nov 07 '14 at 08:18
  • @StephenC The question is really: "How do I create an array." And the answer should be: "Use a List instead." – Tom Hawtin - tackline Nov 07 '14 at 08:24
  • Well assuming that that is what the really question is ... I'm sure we can find one that this is a duplicate of. – Stephen C Nov 07 '14 at 08:38
  • @TomHawtin-tackline I dont want to create a List. I want to create an **array of Java nio Selectors**. – Aditya Nov 07 '14 at 09:57
  • @StephenC Hi Stephen.. Can u give me an example of how to create array of selectors in Java NIO. – Aditya Nov 07 '14 at 10:44
  • `Selector[] selectors = new Selector[42];` Then write a loop to initialize the array. This is very basic Java stuff. Try reading a Java tutorial. – Stephen C Nov 07 '14 at 10:55

0 Answers0