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

add questions

上级 088cd7f2
{
"type": "code_options",
"author": "陈龙",
"author": "clong",
"source": "Input.md",
"exercise_id":"",
"notebook_enable": true
......
......@@ -44,7 +44,7 @@ public class Input {
input = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("输入数据:" + input);
}
}
......
{
"type": "code_options",
"author": "陈龙",
"author": "clong",
"source": "FileRead.md",
"exercise_id":"",
"notebook_enable": true
......
......@@ -65,10 +65,29 @@ public class FileRead {
int length = 0;
Reader reader = new InputStreamReader(new FileInputStream(filePath));
while ((length = reader.read(chars)) != -1) {
for (int i = 0; i < length; i++) {
System.out.print(chars[i]);
}
String str = new String(chars, 0, length);
System.out.print(str);
}
}
}
```
### C
```java
import java.io.*;
public class FileRead {
public static void main(String[] args) throws IOException {
String filePath = "test.txt";
FileReader fr2 = new FileReader(filePath);
char[] buf = new char[20];
int length;
while ((length = fr2.read(buf)) != -1) {
String str = new String(buf, 0, length);
System.out.print(str);
}
}
}
```
\ No newline at end of file
{
"type": "code_options",
"author": "clong",
"source": "FileWriter.md",
"exercise_id":"",
"notebook_enable": true
}
\ No newline at end of file
# FileWriter
`FileWriter` 类是从什么类直接继承而来:
## 答案
```
OutputStreamWriter
```
## 选项
### A
```
Writer
```
### B
```
FilterWriter
```
### C
```java
BufferedWriter
```
\ No newline at end of file
......@@ -19,6 +19,6 @@
}
}
],
"export": ["FileRead.json"],
"export": ["FileRead.json", "FileWriter.json"],
"title": "文件输入输出流"
}
\ No newline at end of file
{
"type": "code_options",
"author": "clong",
"source": "Unzip.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# UnZip
`ZipInputStream` 不包含的方法是:
## 答案
```
createZipEntry()
```
## 选项
### A
```
skip(long n)
```
### B
```
read(byte b, in off, int len)
```
### C
```
getNextEntry()
```
{
"type": "code_options",
"author": "clong",
"source": "Zip.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# Zip
以下 `Zip` 程序中,能正确完成对测试文件压缩的是:
## 答案
```java
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Zip {
public static void main(String[] args) throws IOException {
String zipFileName = "test.zip";
String fileName = "test.txt";
File file = new File(fileName);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
out.putNextEntry(new ZipEntry(""));
FileInputStream in = new FileInputStream(file);
int tmp;
while((tmp = in.read()) != -1) {
out.write(tmp);
}
in.close();
out.close();
}
}
```
## 选项
### A
```java
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Zip {
public static void main(String[] args) throws IOException {
String zipFileName = "test.zip";
String fileName = "test.txt";
File file = new File(fileName);
ZipOutputStream out = new ZipOutputStream(zipFileName);
out.putNextEntry(new ZipEntry(""));
FileInputStream in = new FileInputStream(file);
int tmp;
while((tmp = in.read()) != -1) {
out.write(tmp);
}
in.close();
out.close();
}
}
```
### B
```java
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Zip {
public static void main(String[] args) throws IOException {
String zipFileName = "test.zip";
String fileName = "test.txt";
File file = new File(fileName);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
out.putNextEntry();
FileInputStream in = new FileInputStream(file);
int tmp;
while((tmp = in.read()) != -1) {
out.write(tmp);
}
in.close();
out.close();
}
}
```
### C
```java
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Zip {
public static void main(String[] args) throws IOException {
String zipFileName = "test.zip";
String fileName = "test.txt";
File file = new File(fileName);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
out.putNextEntry(new ZipEntry(""));
FileInputStream in = new FileOutputStream(file);
int tmp;
while((tmp = in.read()) != -1) {
out.write(tmp);
}
in.close();
out.close();
}
}
```
......@@ -19,6 +19,6 @@
}
}
],
"export": [],
"export": ["Zip.json", "Unzip.json"],
"title": "ZIP压缩输入输出流"
}
\ No newline at end of file
{
"type": "code_options",
"author": "clong",
"source": "RandomAccessFile.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# RandomAccessFile
以下关于 `RandomAccessFile` 的说法错误的是:
## 答案
```
RandomAccessFile可以实现对文件以及IO节点的随机访问
```
## 选项
### A
```
getFilePointer和seek是RandomAccessFile实现随机访问的核心方法
```
### B
```
RandomAccessFile使用了指针的思想
```
### C
```
RandomAccessFile可以用来实现多线程下载及断点续传
```
{
"node_id": "java-3c0553280d2a4b60983a5ae18e7112a4",
"keywords": [],
"keywords": ["随机", "访问", "文件"],
"children": [],
"export": [],
"export": ["RandomAccessFile.json"],
"title": "RandomAccessFile"
}
\ No newline at end of file
{
"node_id": "java-21c738a097fb46a4a156d787dc4778b7",
"keywords": [],
"children": [],
"export": [],
"title": "寻找类"
}
\ No newline at end of file
{
"node_id": "java-01546694ece242b6869cb662498c6670",
"keywords": [],
"children": [],
"export": [],
"title": "序列化的控制"
}
\ No newline at end of file
{
"node_id": "java-89c87044f09c446588eb96d76b766dcd",
"keywords": [],
"children": [],
"export": [],
"title": "使用“持久性”"
}
\ No newline at end of file
{
"type": "code_options",
"author": "clong",
"source": "ObjectSerializable.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# Object Serializable
以下关于对象的序列化与反序列化程序中,正确的是:
## aop
### before
```java
//
```
## 答案
```java
import java.io.*;
import java.io.Serializable;
class Student implements Serializable {
private String name;
private String sex;
private Integer age;
public Student(String name, String sex, Integer age) {
this.name = name;
this.sex = sex;
this.age = age;
}
@Override
public String toString() {
return "name:" + this.name + "," + "sex:" + this.sex + "," + "age:" + this.age;
}
}
public class SerializableDemo {
public static void main(String[] args) throws IOException, ClassNotFoundException {
// 序列化
Student student = new Student("小明", "男", 15);
System.out.println(student);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student"));
oos.writeObject(student);
oos.close();
// 反序列化
File file = new File("student");
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
Student student = (Student) ois.readObject();
ois.close();
System.out.println(student);
}
}
```
## 选项
### A
```java
import java.io.*;
public class Student {
private String name;
private String sex;
private Integer age;
public Student(String name, String sex, Integer age) {
this.name = name;
this.sex = sex;
this.age = age;
}
@Override
public String toString() {
return "name:" + this.name + "," + "sex:" + this.sex + "," + "age:" + this.age;
}
}
public class SerializableDemo {
public static void main(String[] args) throws IOException, ClassNotFoundException {
// 序列化
Student student = new Student("小明", "男", 15);
System.out.println(student);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student"));
oos.writeObject(student);
oos.close();
// 反序列化
File file = new File("student");
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
Student student = (Student) ois.readObject();
ois.close();
System.out.println(student);
}
}
```
### B
```java
import java.io.*;
import java.io.Serializable;
public class Student implements Serializable {
private String name;
private String sex;
private Integer age;
public Student(String name, String sex, Integer age) {
this.name = name;
this.sex = sex;
this.age = age;
}
@Override
public String toString() {
return "name:" + this.name + "," + "sex:" + this.sex + "," + "age:" + this.age;
}
}
public class SerializableDemo {
public static void main(String[] args) throws IOException, ClassNotFoundException {
// 序列化
Student student = new Student("小明", "男", 15);
System.out.println(student);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student"));
oos.writeObject(student);
oos.close();
// 反序列化
File file = new File("student");
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
Student student = ois.readObject();
ois.close();
System.out.println(student);
}
}
```
### C
```java
import java.io.*;
import java.io.Serializable;
public class Student implements Serializable {
private String name;
private String sex;
private Integer age;
public Student(String name, String sex, Integer age) {
this.name = name;
this.sex = sex;
this.age = age;
}
@Override
public String toString() {
return "name:" + this.name + "," + "sex:" + this.sex + "," + "age:" + this.age;
}
}
public class SerializableDemo {
public static void main(String[] args) throws IOException, ClassNotFoundException {
// 序列化
Student student = new Student("小明", "男", 15);
System.out.println(student);
ObjectOutputStream oos = new ObjectOutputStream(new FileInputStream("student"));
oos.writeObject(student);
oos.close();
// 反序列化
File file = new File("student");
ObjectInputStream ois = new ObjectInputStream(new FileOutputStream(file));
Student student = (Student) ois.readObject();
ois.close();
System.out.println(student);
}
}
```
......@@ -2,6 +2,6 @@
"node_id": "java-ec1081c263a84d41b692d4821d8254e6",
"keywords": [],
"children": [],
"export": [],
"export": ["ObjectSerializable.json"],
"title": "对象序列化"
}
\ No newline at end of file
{
"type": "code_options",
"author": "clong",
"source": "Abstarct.md",
"exercise_id": "",
"notebook_enable": true
}
\ No newline at end of file
# JDBC abstract
以下关于 `JDBC` 的说法错误的是:
## 答案
```
```
## 选项
### A
```
JDBC全称是Java DataBase Connection
```
### B
```
JDBC由一组Java语言编写的类与接口组成
```
### C
```
JDBC是一种标准Java应用编程接口
```
......@@ -27,6 +27,6 @@
}
}
],
"export": [],
"export": ["Abstract.json"],
"title": "JDBC概述"
}
\ No newline at end of file
{
"node_id": "java-fd66a76b04b84d8da4454f6f9728aca0",
"keywords": [],
"keywords": ["数据库", "操作", "添加", "修改", "删除", "查询"],
"children": [
{
"数据库基础": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册