diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.json" index 1e300ee04e068e69934f3017e75f28a62198b442..6872abfcefd9290ccbfdc19bb90f181440a8fa7f 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.json" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.json" @@ -1,6 +1,6 @@ { "type": "code_options", - "author": "陈龙", + "author": "clong", "source": "Input.md", "exercise_id":"", "notebook_enable": true diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.md" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.md" index 62de67b54a1c27fe18cfed0ff8a71b1a761be66a..a3661ea493fd33820ab6b79aa7a679b5c1f8d154 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.md" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/2.\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Input.md" @@ -44,7 +44,7 @@ public class Input { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); - } + } System.out.println("输入数据:" + input); } } diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.json" index d768670b1494965f91ddcfaf6a7498a099ebedca..50047c31519caa4842c4eb13ce5c8e733e58c78c 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.json" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.json" @@ -1,6 +1,6 @@ { "type": "code_options", - "author": "陈龙", + "author": "clong", "source": "FileRead.md", "exercise_id":"", "notebook_enable": true diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.md" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.md" index 18bbbd275ce281b9e4c0ab9517cabe063b0d23f5..4c12b9cab97dc3754fcca954f436f66d5491ee0c 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.md" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileRead.md" @@ -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 diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.json" new file mode 100644 index 0000000000000000000000000000000000000000..6ff1ea05898f16d720a83774739d809aafb6086a --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "FileWriter.md", + "exercise_id":"", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.md" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.md" new file mode 100644 index 0000000000000000000000000000000000000000..ab9215d96b6625ab38bc3cf0c8ff233fe077d808 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/FileWriter.md" @@ -0,0 +1,31 @@ +# FileWriter + + +`FileWriter` 类是从什么类直接继承而来: + + +## 答案 + +``` +OutputStreamWriter +``` + +## 选项 + +### A + +``` +Writer +``` + +### B + +``` +FilterWriter +``` + +### C + +```java +BufferedWriter +``` \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" index 721c40f245b07aaa99bb3ae29f9a2616c6f5c58c..5ff825891d688f81aef9c7d3f320ba44ab8c7cae 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/3.\346\226\207\344\273\266\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" @@ -19,6 +19,6 @@ } } ], - "export": ["FileRead.json"], + "export": ["FileRead.json", "FileWriter.json"], "title": "文件输入输出流" } \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.json" new file mode 100644 index 0000000000000000000000000000000000000000..88bb6cd9d54b7a993d2c4a6002e42cafaec20dc9 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "Unzip.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.md" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.md" new file mode 100644 index 0000000000000000000000000000000000000000..6f46bf98fb0938ef3399324121cc222d8296758e --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Unzip.md" @@ -0,0 +1,32 @@ +# UnZip + + +`ZipInputStream` 不包含的方法是: + + +## 答案 + +``` +createZipEntry() +``` + +## 选项 + +### A + +``` +skip(long n) +``` + +### B + +``` +read(byte b, in off, int len) +``` + +### C + +``` +getNextEntry() +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.json" new file mode 100644 index 0000000000000000000000000000000000000000..c435ff459f1c6dc8d88e28b719639393a93de97b --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "Zip.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.md" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.md" new file mode 100644 index 0000000000000000000000000000000000000000..25810eabfceceba89645320cfa4e127244f992b8 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/Zip.md" @@ -0,0 +1,108 @@ +# 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(); + } +} +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" index 593f5486bc2d0080de5ddf94bf429b3af13162d9..b6d31b021fbe132d8dd60e4f2b4b237c8ecdf986 100644 --- "a/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/1.IO\357\274\210\350\276\223\345\205\245\350\276\223\345\207\272\357\274\211/7.ZIP\345\216\213\347\274\251\350\276\223\345\205\245\350\276\223\345\207\272\346\265\201/config.json" @@ -19,6 +19,6 @@ } } ], - "export": [], + "export": ["Zip.json", "Unzip.json"], "title": "ZIP压缩输入输出流" } \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.json" "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.json" new file mode 100644 index 0000000000000000000000000000000000000000..1cff7fa356ef790fef21222d5304d9535c0d6d61 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "RandomAccessFile.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.md" "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.md" new file mode 100644 index 0000000000000000000000000000000000000000..127cd22b12e5c9cbadab0050560960cc48710864 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/RandomAccessFile.md" @@ -0,0 +1,32 @@ +# RandomAccessFile + + +以下关于 `RandomAccessFile` 的说法错误的是: + + +## 答案 + +``` +RandomAccessFile可以实现对文件以及IO节点的随机访问 +``` + +## 选项 + +### A + +``` +getFilePointer和seek是RandomAccessFile实现随机访问的核心方法 +``` + +### B + +``` +RandomAccessFile使用了指针的思想 +``` + +### C + +``` +RandomAccessFile可以用来实现多线程下载及断点续传 +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/config.json" "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/config.json" index e768a16e5266c1ae3bdfe7e3a828770fd9393abe..7bf9716b3eda13523ed09434872a7551581729a9 100644 --- "a/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/2.RandomAccessFile/config.json" @@ -1,7 +1,7 @@ { "node_id": "java-3c0553280d2a4b60983a5ae18e7112a4", - "keywords": [], + "keywords": ["随机", "访问", "文件"], "children": [], - "export": [], + "export": ["RandomAccessFile.json"], "title": "RandomAccessFile" } \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/1.\345\257\273\346\211\276\347\261\273/config.json" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/1.\345\257\273\346\211\276\347\261\273/config.json" deleted file mode 100644 index ad334e5c4b755fb160ffeb43d184ac38dcb9e1e0..0000000000000000000000000000000000000000 --- "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/1.\345\257\273\346\211\276\347\261\273/config.json" +++ /dev/null @@ -1,7 +0,0 @@ -{ - "node_id": "java-21c738a097fb46a4a156d787dc4778b7", - "keywords": [], - "children": [], - "export": [], - "title": "寻找类" -} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/2.\345\272\217\345\210\227\345\214\226\347\232\204\346\216\247\345\210\266/config.json" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/2.\345\272\217\345\210\227\345\214\226\347\232\204\346\216\247\345\210\266/config.json" deleted file mode 100644 index b2a9964ec1eebb07ab11f5d26e52da283168d765..0000000000000000000000000000000000000000 --- "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/2.\345\272\217\345\210\227\345\214\226\347\232\204\346\216\247\345\210\266/config.json" +++ /dev/null @@ -1,7 +0,0 @@ -{ - "node_id": "java-01546694ece242b6869cb662498c6670", - "keywords": [], - "children": [], - "export": [], - "title": "序列化的控制" -} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/3.\344\275\277\347\224\250\342\200\234\346\214\201\344\271\205\346\200\247\342\200\235/config.json" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/3.\344\275\277\347\224\250\342\200\234\346\214\201\344\271\205\346\200\247\342\200\235/config.json" deleted file mode 100644 index f8ad9cfa7f3811f8092c443e566fa14bd8f984d1..0000000000000000000000000000000000000000 --- "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/3.\344\275\277\347\224\250\342\200\234\346\214\201\344\271\205\346\200\247\342\200\235/config.json" +++ /dev/null @@ -1,7 +0,0 @@ -{ - "node_id": "java-89c87044f09c446588eb96d76b766dcd", - "keywords": [], - "children": [], - "export": [], - "title": "使用“持久性”" -} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.json" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.json" new file mode 100644 index 0000000000000000000000000000000000000000..dde7c37a401c5a7b6313e3b07a09efcd295825bc --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "ObjectSerializable.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.md" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.md" new file mode 100644 index 0000000000000000000000000000000000000000..d944fe2dd219f2dfc4b7500ef0f25d703449feed --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/ObjectSerializable.md" @@ -0,0 +1,178 @@ +# 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); + } +} +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/config.json" "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/config.json" index 0142984dc66af8fc5ef431aa868a3d00895ab4a5..2578de8bf9d0efe8ce409e08df33d803ed9fbae1 100644 --- "a/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/3.\345\257\271\350\261\241\345\272\217\345\210\227\345\214\226/config.json" @@ -2,6 +2,6 @@ "node_id": "java-ec1081c263a84d41b692d4821d8254e6", "keywords": [], "children": [], - "export": [], + "export": ["ObjectSerializable.json"], "title": "对象序列化" } \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.json" "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.json" new file mode 100644 index 0000000000000000000000000000000000000000..24f02e131d144d3443038b8f914922a6f62ee78c --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "Abstarct.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.md" "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.md" new file mode 100644 index 0000000000000000000000000000000000000000..9c5391683ad8f9085007545de1510e88ecaff851 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/Abstract.md" @@ -0,0 +1,32 @@ +# JDBC abstract + + +以下关于 `JDBC` 的说法错误的是: + + +## 答案 + +``` + +``` + +## 选项 + +### A + +``` +JDBC全称是Java DataBase Connection +``` + +### B + +``` +JDBC由一组Java语言编写的类与接口组成 +``` + +### C + +``` +JDBC是一种标准Java应用编程接口 +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/config.json" "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/config.json" index 800c9e16aeb4882481ec946b36a5481e2a4ff195..12d762db5c732f35cb15704310b9043d5d7de386 100644 --- "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/1.JDBC\346\246\202\350\277\260/config.json" @@ -27,6 +27,6 @@ } } ], - "export": [], + "export": ["Abstract.json"], "title": "JDBC概述" } \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/2.\346\225\260\346\215\256\345\272\223\346\223\215\344\275\234/config.json" "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/2.\346\225\260\346\215\256\345\272\223\346\223\215\344\275\234/config.json" index 43b0e29fcd2e5147fa7f270e9217217378766175..6221b6ec7c5433a2891579e4e1dd6a2076172a22 100644 --- "a/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/2.\346\225\260\346\215\256\345\272\223\346\223\215\344\275\234/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/4.\344\275\277\347\224\250JDBC\346\223\215\344\275\234\346\225\260\346\215\256\345\272\223/2.\346\225\260\346\215\256\345\272\223\346\223\215\344\275\234/config.json" @@ -1,6 +1,6 @@ { "node_id": "java-fd66a76b04b84d8da4454f6f9728aca0", - "keywords": [], + "keywords": ["数据库", "操作", "添加", "修改", "删除", "查询"], "children": [ { "数据库基础": {