提交 42862151 编写于 作者: CSDN-Ada助手's avatar CSDN-Ada助手

add nio questions

上级 4a92d175
{
"type": "code_options",
"author": "clong",
"source": "BufferRead.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# Buffer Read
以下关于 `Buffer` 的使用,正确的是:
## 答案
```java
import java.nio.DoubleBuffer;
public class BufferTest {
public static void main(String[] args) {
DoubleBuffer doubleBuffer = DoubleBuffer.allocate(10);
doubleBuffer.put(12.0);
doubleBuffer.put(25.0);
doubleBuffer.flip();
System.out.println(doubleBuffer.get());
System.out.println(doubleBuffer.get());
doubleBuffer.clear();
}
}
```
## 选项
### A
```java
import java.nio.CharBuffer;
public class BufferTest {
public static void main(String[] args) {
CharBuffer charBuffer = CharBuffer.allocate(1);
charBuffer.put("test");
charBuffer.flip();
System.err.println(charBuffer.get());
}
}
```
### B
```java
import java.nio.IntBuffer;
public class BufferTest {
public static void main(String[] args) {
IntBuffer intBuffer = IntBuffer.allocate(1);
intBuffer.put(25);
intBuffer.put(12);
intBuffer.flip();
System.err.println(intBuffer.get());
System.err.println(intBuffer.get());
}
}
```
### C
```java
import java.nio.ByteBuffer;
public class BufferTest {
public static void main(String[] args) {
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
byte a = 12;
byteBuffer.put(a);
System.err.println(byteBuffer.get());
}
}
```
{
"type": "code_options",
"author": "clong",
"source": "BufferType.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# Buffer Type
以下不属于Java NIO的 `Buffer` 类型的是:
## 答案
```
StringBuffer
```
## 选项
### A
```
ByteBuffer
```
### B
```
CharBuffer
```
### C
```
DoubleBuffer
```
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
"node_id": "java-e622e94340ee4f00ae2aec33047cb19f", "node_id": "java-e622e94340ee4f00ae2aec33047cb19f",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": ["BufferType.json", "BufferRead.json"],
"title": "Buffer(缓冲器)" "title": "Buffer(缓冲器)"
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册