This has nothing to do with NIO and everything to do with language syntax. You have:
Files.write("example.txt",byte[] byteArray);
I don't know what your intention is with that, but you can't declare a variable in a function parameter list like that. You probably mean something like:
byte[] byteArray = ...; // populate with data to write.
Files.write("example.txt", byteArray);
For a more formal view, dig around through the JLS, starting at JLS 15.12. There is ultimately no ArgumentList
pattern in the language that can accept a LocalVariableDeclarationStatement
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…