OOP with Java 通知 Project 6: 5 月 24 日晚 9 点

Size: px
Start display at page:

Download "OOP with Java 通知 Project 6: 5 月 24 日晚 9 点"

Transcription

1 OOP with Java Yuanbin Wu

2 OOP with Java 通知 Project 6: 5 月 24 日晚 9 点

3 复习 异常处理 语法 抛出异常 : throw 处理异常 : try, catch 异常对象 : Exception 类的子类 从方法中抛出异常 方法的异常说明 :throws 中断当前方法的执行, 返回抛出的异常对象, 在该方法的调用路径上寻找合适的 catch.

4 class SimpleException extends Exception { public class InheritingExceptions { public static void main(string[] args) { try { System.out.println("Throw SimpleException from f()"); throw new SimpleException(); catch(exception e) { System.out.println("Caught it!"); System.out.println(e); System.out.println(e.printStackTrace(System.out));

5 bar() throws Type1Exception, Type2Exception{ throw new Type1Exception (); throw new Type2Exception (); foo() { try{ bar(); catch (Type1Exception e){... catch (Type2Exception e){...

6

7 Quiz class Main { public static void main(string args[]){ final int i; i = 20; i = 30; System.out.println(i);

8 Quiz abstract class demo { public int a; demo() { a = 10; abstract public void set(); abstract final public void get(); class Test extends demo { public void set(int a) { this.a = a; final public void get() { System.out.println("a = " + a); public static void main(string[] args) { Test obj = new Test(); obj.set(20); obj.get();

9 Quiz class Test { public static void main (String[] args) { try { int a = 0; System.out.println ("a = " + a + "\n"); int b = 20 / a; System.out.println ("b = " + b); catch(arithmeticexception e) { System.out.println ("Divide by zero error"); finally { System.out.println ("inside the finally block");

10 public class Test { private int x = 1; private int y = 2; private static int z = 3; Quiz public static void main(string[] args) { int x = 4; int y = 5; int z = 6; new Test().new Inner().init(); class Inner{ void init(){ System.out.println(x + " " + y + " " +z);

11 Quiz 1. 定义一个 LinkedList, 其中包含 String 对象. 2. 编写方法遍历该 LinkedList.

12 I/O Introduction Path Object InputStream/OutputStream Reader/Writer Typical usage of I/O streams Object Serialization

13 Introduction I/O Input/output 哪些行为有 I/O 操作? I/O 操作是复杂的 多种交互的设备

14 Introduction I/O 过程的抽象 流 (Stream) Input Output

15 Introduction 数据的来源 (In), 目的地 (Out) 字节 (01 串 ): ByteArrayStream 文件 : FileStream 字符串 : StringStream 对象 : ObjectStream

16 Introduction 最重要的 I/O Stream 操作 InputStream: read() OutputStream: write() close() 为生活带来便利的 I/O Stream 操作 从文件读取一行 : readline() 读取一个基本类型 : readint(), readdouble() 读取对象

17 public static void fileoutput() throws IOException{ String str = "hello world!"; File file = new File("d:\\test2.txt"); // 创建文件 if(!file.exists()){ file.createnewfile(); // 如果文件不存在, 则进行创建 FileOutputStream foutput = new FileOutputStream(file); BufferedOutputStream boutput = new BufferedOutputStream(fOutput); byte[] buffer = str.getbytes(); // 将字符串文本转换成字节数组 boutput.write(buffer); boutput.close(); foutput.close(); public static void fileinput() throws IOException{ File file = new File("d:\\test2.txt"); // 创建文件 FileInputStream fiutput = new FileInputStream(file); BufferedInputStream biutput = new BufferedInputStream(fIutput); int temp = 0; while((temp = biutput.read())!= -1){ // 当 temp 为 -1 时, 数据读取完毕 System.out.print((char)temp); biutput.close(); fiutput.close();

18 Path 接口 File 类 Java 7 之前 Path 接口 Java 7 引入, 用于替代 File 类 File 类对象可通过 topath() 得到对应的 Path 对象

19 Path 接口 文件路径 绝对路径 C:/Documents/tmp/Hello.java 相对路径../../tmp/Hello.java

20 Path 接口 Path 接口 java.nio.file 提供对文件路径字符串的操作

21 Path 接口 创建 Path 类型的对象 Path p1 = Paths.get("C:/Document/tmp/Hello.java"); Path p2 = FileSystems.getDefault().getPath("C:/Document/tmp/Hello.java");

22 Path 接口 // Microsoft Windows syntax Path path = Paths.get("C:\\home\\joe\\foo"); // Solaris syntax // Path path = Paths.get("/home/joe/foo"); System.out.format("toString: %s%n", path.tostring()); System.out.format("getFileName: %s%n", path.getfilename()); System.out.format("getName(0): %s%n", path.getname(0)); System.out.format("getNameCount: %d%n", path.getnamecount()); System.out.format("subpath(0,2): %s%n", path.subpath(0,2)); System.out.format("getParent: %s%n", path.getparent()); System.out.format("getRoot: %s%n", path.getroot()); // C:\home\joe\foo // foo // home // 3 // home\joe // home\joe\ // C:\

23 Files 类 包含文件操作的静态方法 文件是否存在 创建文件 删除文件 拷贝 / 移动 重命名 列出目录下所有文件...

24 Files 类 判断文件是否存在 Path p = Paths.get("C:/Document/tmp/Hello.java"); System.out.println(Files.exists(p)); 判断文件是否可读 / 可写 / 可执行 Path p = Paths.get("C:/Document/tmp/Hello.java"); System.out.println(Files.isReadable(p)); System.out.println(Files.isWritable(p)); System.out.println(Files.isExecutable(p));

25 Files 类 删除文件 try { Files.delete(path); catch (NoSuchFileException x) { System.out.format("%s: no such" + " file or directory%n", path); catch (DirectoryNotEmptyException x) { System.out.format("%s not empty%n", path); catch (IOException x) { // File permission problems are caught here. System.out.println(x);

26 Files 类 获得文件相关的信息 size(path) isdirectory(path, LinkOption) isregularfile(path, LinkOption...) issymboliclink(path) getlastmodifiedtime(path, LinkOption...) setlastmodifiedtime(path, FileTime) getowner(path, LinkOption...) setowner(path, UserPrincipal)

27 Stream I/O 流 InputStream 类 抽象类 read() ( 抽象方法 ) close() OutputStream 类 抽象类 write() ( 抽象方法 ) close() 每次读入 / 写出一个字节

28 从不同的源头产生输入 Byte arrays String objects files InputStream 对应于不同的 InputStream 子类

29 InputStream ByteArrayInputStream StringBufferInputStream FileInputStream...

30 OutputStream 输出到不同的目的地 Byte arrays String objects files 对应于不同的 OutputStream 子类

31 OutputStream ByteArrayOutputStream FileOutputStream...

32 Stream InputStream ByteArrayInputStream StringBufferInputStream FileInputStream... OutputStream ByteArrayOutputStream FileOutputStream...

33 import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; public class CopyBytes { public static void main(string[] args) throws IOException { FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream("xanadu.txt"); out = new FileOutputStream("outagain.txt"); int c; while ((c = in.read())!= -1) out.write(c); finally { if (in!= null) in.close(); if (out!= null) out.close();

34 Stream 是否有效 InputStream/OutputStream 每次读 / 写一个字节 缓冲区 (buffer) 可以帮助提高效率 是否易用 有时需要读入 / 写出一个基本类型, 而不是字节 readint(), readdouble() 是否易读 需要格式化的输出 println(), print(), printf(),..

35 Stream 希望 : 对每一种输入输出流都可以 选择是否带缓冲 选择读入字节还是基本类型 提供格式化的输出 How?

36 Stream 如何实现带缓冲的输入 / 输出流? 方案 1: read() 方法增加参数 read(byte[ ], int off, int len) 缺点 buffer 长度需要用户指定 用户需要知道更多实现细节

37 Stream 如何实现带缓冲的输入 / 输出流? 方案 2 继承 BufferedByteArrayInputStream, BufferedByteArrayOutputStream BufferedStringBufferInputStream, BufferedStringBufferOutputStream BufferedFileInputStream, BufferedFileOutputStream 缺点 类过多 无法动态加载

38 Stream 如何实现带缓冲的输入 / 输出流? 方案 3 组合 定义 BufferedInputStream 类 包含一个 InputStream 对象作为成员 调用该 InputStream 对象的 read(byte[], int off, int len) 实现缓冲 该调用在不同系统上有不同的优化, 并且被封装

39 FileInputStream fin = new FileInputStream("xanadu.txt"); BufferedInputStream bf = new BufferedInputStream(fin); bf.read(); // buffered read FileOutputStream fout = new FileOutputStream("xanadu.txt"); BufferedOutputStream bf = new BufferedOutputStream(fout); bf.write(1); // buffered write ByteArrayInputStream bin = new ByteArrayInputStream("xanadu.txt".getBytes()); BufferedInputStream bf = new BufferedInputStream(bin); bf.read(); // buffered read ByteArrayOutputStream bout = new ByteArrayOutputStream("xanadu.txt".getBytes()); BufferedOutputStream bf = new BufferedOutputStream(bout); bf.write(1); // buffered read

40 Stream 添加缓冲功能 BufferedInputStream 添加读取基本类型功能 DataInputStream readint(), readdouble(), readfloat(),...

41 FileInputStream fin = new FileInputStream("xanadu.txt"); DataInputStream din = new DataInputStream(fin); din.read(); din.readint(); din.readdouble(); FileOutputStream fout = new FileOutputStream("xanadu.txt"); DataOutputStream dout = new DataOutputStream(fout); dout.write(1); dout.writeint(10), dout.writedouble(3.14); ByteArrayInputStream bin = new ByteArrayInputStream("xanadu.txt".getBytes()); DataInputStream din = new DataInputStream(bin); din.read(); din.readint(); din.readdouble(); ByteArrayOutputStream bout = new ByteArrayOutputStream("xanadu.txt".getBytes()); DataOutputStream bout = new DataOutputStream(bout); bout.write(1); bout.writeint(10), bout.writedouble(3.14);

42 Stream 添加缓冲功能 BufferedInputStream 添加读取基本类型功能 DataInputStream readint(), readdouble(), readfloat(),... 添加格式化输出功能 PrintStream println(), print(),

43 FileOutputStream fout = new FileOutputStream("xanadu.txt"); PrintStream ps = new PrintStream(fout); ps.write(1); ps.println( hello ); ps.print( world ); ByteArrayOutputStream bout = new ByteArrayOutputStream("xanadu.txt".getBytes()); PrintStream ps = new PrintStream(bout); ps.write(1); ps.println( hello ); ps.print( world );

44 FilterInputStream 抽象类 特点 BufferedInputStream, DataInputStream 为 InputStream 的子类 具有 InputStream 所有的类的子类接口

45 FilterInputStream 构造函数 : FilterInputStream(InputStream in) protected InputStream FilterInputStream BufferdInputStream DataInputStream

46 FilterOutputStream OutputStream FilterOutputStream BufferdOutputStream DataOutputStream PrintStream

47 FilterInputStream 特点 为 InputStream 的子类 需要被继承 ( 构造函数是 protected) BufferedInputStream, DataInputStream FilterInputStream 的对象可以作为 FilterInputStream 的参数!

48 FileInputStream fin = new FileInputStream("xanadu.txt"); BufferedInputStream bf = new BufferedInputStream(fin); DataInputStream din = new DataInputStream(bf); din.read(); din.readint(); din.readdouble(); FileOutputStream fout = new FileOutputStream("xanadu.txt"); BufferedOutputStream bf = new BufferedOutputStream(fout); DataOutputStream dout = new DataOutputStream(bf); dout.write(1); dout.writeint(10); dout.writedouble(3.14);

49 Decorator pattern InputStream ByteArrayInputStream FileInputStream StringBufferInputStream FilterInputStream BufferdInputStream DataInputStream 装饰器

50 总结 Stream InputStream, OutputStream 根据数据源的不同, 分为 FileInputStream, ByteArrayInputStream FileOutputStream, ByteArrayOutputStream 可以有不同的装饰器 BufferedInputStream, DataInputStream PrintStream

51 public static void fileoutput() throws IOException{ String str = "hello world!"; File file = new File("d:\\test2.txt"); // 创建文件 if(!file.exists()){ file.createnewfile(); // 如果文件不存在, 则进行创建 FileOutputStream foutput = new FileOutputStream(file); BufferedOutputStream boutput = new BufferedOutputStream(fOutput); byte[] buffer = str.getbytes(); // 将字符串文本转换成字节数组 boutput.write(buffer); boutput.close(); foutput.close(); public static void fileinput() throws IOException{ File file = new File("d:\\test2.txt"); // 创建文件 FileInputStream fiutput = new FileInputStream(file); BufferedInputStream biutput = new BufferedInputStream(fIutput); int temp = 0; while((temp = biutput.read())!= -1){ // 当 temp 为 -1 时, 数据读取完毕 System.out.print((char)temp); biutput.close(); fiutput.close();

52 Reader / Writer InputStream, OutputStream 每次读入 / 写出一个字节 Reader, Writer 每次读入 / 写出一个字符 Utf-16 每次读入 / 写出 16bit, 或者 32bit

53 Reader / Writer 读写字节 InputStream OutputStream FileInputStream FileOutputStream StringBufferInputStrea m (no corresponding class) ByteArrayInputStream ByteArrayOutputStrea m 读写字符 Reader Writer FileReader FileWriter StringReader StringWriter CharArrayReader CharArrayWriter

54 Reader / Writer decorators 读写字节 FilterInputStream FilterOutputStream BufferedInputStream BufferedOutputStream DataInputStream 读写字符 FilterReader FilterWriter BufferedReader BufferedWriter DataInputStream DataOutputStream PrintStream DataOutputStream PrintWriter PrintWriter 可以用 OutputStream 作为参数

55 例子 Typical uses of I/O streams

56 import java.io.*; public class BufferedInputFile { // Throw exceptions to console: public static String read(string filename) throws IOException { // Reading input by lines: BufferedReader in = new BufferedReader(new FileReader(filename)); String s; StringBuilder sb = new StringBuilder(); while((s = in.readline())!= null) sb.append(s + "\n"); in.close(); return sb.tostring(); public static void main(string[] args) throws IOException { System.out.print(read("BufferedInputFile.java"));

57 import java.io.*; public class MemoryInput { public static void main(string[] args) throws IOException { StringReader in = new StringReader( BufferedInputFile.read("MemoryInput.java")); int c; while((c = in.read())!= -1) System.out.print((char)c);

58 import java.io.*; public class FormattedMemoryInput { public static void main(string[] args) throws IOException { try { DataInputStream in = new DataInputStream( new ByteArrayInputStream( BufferedInputFile.read( "FormattedMemoryInput.java").getBytes())); while(true) System.out.print((char)in.readByte()); catch(eofexception e) { System.err.println("End of stream");

59 import java.io.*; public class TestEOF { public static void main(string[] args) throws IOException { DataInputStream in = new DataInputStream( new BufferedInputStream( new FileInputStream("TestEOF.java"))); while(in.available()!= 0) System.out.print((char)in.readByte());

60 import java.io.*; public class BasicFileOutput { static String file = "BasicFileOutput.out"; public static void main(string[] args) throws IOException { BufferedReader in = new BufferedReader( new StringReader( BufferedInputFile.read("BasicFileOutput.java"))); PrintWriter out = new PrintWriter( new BufferedWriter(new FileWriter(file))); int linecount = 1; String s; while((s = in.readline())!= null ) out.println(linecount++ + ": " + s); out.close(); // Show the stored file: System.out.println(BufferedInputFile.read(file)); Short cut: PrintWriter out = new PrinterWriter(file);

61 import java.io.*; public class StoringAndRecoveringData { public static void main(string[] args) throws IOException { DataOutputStream out = new DataOutputStream( new BufferedOutputStream(new FileOutputStream("Data.txt"))); out.writedouble( ); out.writeutf("that was pi"); out.writedouble( ); out.writeutf("square root of 2"); out.close(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream("Data.txt"))); System.out.println(in.readDouble()); // Only readutf() will recover the // Java-UTF String properly: System.out.println(in.readUTF()); System.out.println(in.readDouble()); System.out.println(in.readUTF());

62 Standard I/O System.out PrintStream System.err PrintStream System.in 需要一些预处理

63 import java.io.*; public class Echo { public static void main(string[] args) throws IOException { BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in)); String s; while((s = stdin.readline())!= null && s.length()!= 0) System.out.println(s);

OOP with Java 通知 Project 6: 5 月 30 日晚 9 点

OOP with Java 通知 Project 6: 5 月 30 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 6: 5 月 30 日晚 9 点 复习 异常处理 语法 抛出异常 : throw 处理异常 : try, catch 异常对象 : Exception 类的子类 从方法中抛出异常 方法的异常说明 :throws 中断当前方法的执行, 返回抛出的异常对象, 在该方法的调用路径上寻找合适的

More information

OOP with Java 通知 Project 6: 6 月 6 日晚 9 点

OOP with Java 通知 Project 6: 6 月 6 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 6: 6 月 6 日晚 9 点 复习 异常处理 语法 抛出异常 : throw 处理异常 : try, catch 异常对象 : Exception 类的子类 从方法中抛出异常 方法的异常说明 :throws 中断当前方法的执行, 返回抛出的异常对象, 在该方法的调用路径上寻找合适的

More information

Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream Class java.io.datainptstream (extends) FilterInputStream InputStream Obj

Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream Class java.io.datainptstream (extends) FilterInputStream InputStream Obj Message Transition 5-1 5-2 DataInputStream Class 5-3 DataOutputStream Class 5-4 PrintStream Class 5-5 (Message Transition) (Exercises) Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream

More information

OOP with Java 通知 Project 7, 6 月 14 日晚 9 点 本周四上机课正常进行 答疑 本周三, 周五下午 1:00 3:00, 理科楼 B911 6 月 12 日考试 ( 随堂 ) 下午 1:00-3:00 教书院 218

OOP with Java 通知 Project 7, 6 月 14 日晚 9 点 本周四上机课正常进行 答疑 本周三, 周五下午 1:00 3:00, 理科楼 B911 6 月 12 日考试 ( 随堂 ) 下午 1:00-3:00 教书院 218 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 7, 6 月 14 日晚 9 点 本周四上机课正常进行 答疑 本周三, 周五下午 1:00 3:00, 理科楼 B911 6 月 12 日考试 ( 随堂 ) 下午 1:00-3:00 教书院 218 OOP with Java 题目类型 : 选择 : 30% 问答 : 30% 编程 :

More information

OOP with Java 通知 Project 7 :6 月 27 日晚 9 点 6 月 14 日复习 6 月 21 日考试 答疑 6 月 20 日 13 : : 00 理科楼 B911

OOP with Java 通知 Project 7 :6 月 27 日晚 9 点 6 月 14 日复习 6 月 21 日考试 答疑 6 月 20 日 13 : : 00 理科楼 B911 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 7 :6 月 27 日晚 9 点 6 月 14 日复习 6 月 21 日考试 答疑 6 月 20 日 13 : 00 15 : 00 理科楼 B911 abstract class demo { public int a; demo() { a = 10; abstract public

More information

OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数

OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double

More information

JavaIO.PDF

JavaIO.PDF O u t p u t S t ream j a v a. i o. O u t p u t S t r e a m w r i t e () f l u s h () c l o s e () public abstract void write(int b) throws IOException public void write(byte[] data) throws IOException

More information

OOP with Java 通知 Project 7 :6 月 14 日晚 9 点 6 月 5 日复习 6 月 12 日考试

OOP with Java 通知 Project 7 :6 月 14 日晚 9 点 6 月 5 日复习 6 月 12 日考试 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 7 :6 月 14 日晚 9 点 6 月 5 日复习 6 月 12 日考试 复习 I/O 流 InputStream/Reader read() OutputStream/Writer write() 抽象 : 数据的来源 / 数据的目的地 ByteArrayStream, FileStream

More information

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double x) { d

More information

while ((ch = fr.read())!= -1) { System.out.print((char) ch); fr.close(); 例 3: 用 BufferedReader 读 TXT 文件 public class FileReaderDemo3 { public static v

while ((ch = fr.read())!= -1) { System.out.print((char) ch); fr.close(); 例 3: 用 BufferedReader 读 TXT 文件 public class FileReaderDemo3 { public static v 第九章 Java I/O 流操作 实验目的 (1) 掌握文本文件的读写方法 (2) 掌握 InputStream OutputStream 的使用方法 (3) 熟悉 FileReader,BufferedReader,InputStreamReader 和 FileWriter, BufferedWriter, PrintWriter 的使用方法 ; 理解使用过滤流实现数据项的读写 :DataOutputStream,

More information

chp6.ppt

chp6.ppt Java 软 件 设 计 基 础 6. 异 常 处 理 编 程 时 会 遇 到 如 下 三 种 错 误 : 语 法 错 误 (syntax error) 没 有 遵 循 语 言 的 规 则, 出 现 语 法 格 式 上 的 错 误, 可 被 编 译 器 发 现 并 易 于 纠 正 ; 逻 辑 错 误 (logic error) 即 我 们 常 说 的 bug, 意 指 编 写 的 代 码 在 执 行

More information

untitled

untitled Velocity 14 100061 315@pptph.com.cn http://www.pptph.com.cn 010-67129212 010-67129211 787 1092 1/16 22 535 1 0 000 2001 11 1 2001 11 1 ISBN 7-115-09828-X/TP 2577 32.00 01067129223 1 2 1 2 3 4 5 1 Velocity

More information

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double x) { d =

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-055Big5 Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0 Version : Demo 1 / 22 1. 11. public static void parse(string str)

More information

OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课

OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课 复习 Java 包 创建包 : package 语句, 包结构与目录结构一致 使用包 : import restaurant/ - people/ - Cook.class - Waiter.class - tools/ - Fork.class

More information

Guava学习之Resources

Guava学习之Resources Resources 提供提供操作 classpath 路径下所有资源的方法 除非另有说明, 否则类中所有方法的参数都不能为 null 虽然有些方法的参数是 URL 类型的, 但是这些方法实现通常不是以 HTTP 完成的 ; 同时这些资源也非 classpath 路径下的 下面两个函数都是根据资源的名称得到其绝对路径, 从函数里面可以看出,Resources 类中的 getresource 函数都是基于

More information

EJB-Programming-4-cn.doc

EJB-Programming-4-cn.doc EJB (4) : (Entity Bean Value Object ) JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Session Bean J2EE Session Façade Design Pattern Session Bean Session

More information

1: public class MyOutputStream implements AutoCloseable { 3: public void close() throws IOException { 4: throw new IOException(); 5: } 6:

1: public class MyOutputStream implements AutoCloseable { 3: public void close() throws IOException { 4: throw new IOException(); 5: } 6: Chapter 15. Suppressed Exception CH14 Finally Block Java SE 7 try-with-resources JVM cleanup try-with-resources JVM cleanup cleanup Java SE 7 Throwable getsuppressed Throwable[] getsuppressed() Suppressed

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc 2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.

More information

雲端 Cloud Computing 技術指南 運算 應用 平台與架構 10/04/15 11:55:46 INFO 10/04/15 11:55:53 INFO 10/04/15 11:55:56 INFO 10/04/15 11:56:05 INFO 10/04/15 11:56:07 INFO

雲端 Cloud Computing 技術指南 運算 應用 平台與架構 10/04/15 11:55:46 INFO 10/04/15 11:55:53 INFO 10/04/15 11:55:56 INFO 10/04/15 11:56:05 INFO 10/04/15 11:56:07 INFO CHAPTER 使用 Hadoop 打造自己的雲 8 8.3 測試 Hadoop 雲端系統 4 Nodes Hadoop Map Reduce Hadoop WordCount 4 Nodes Hadoop Map/Reduce $HADOOP_HOME /home/ hadoop/hadoop-0.20.2 wordcount echo $ mkdir wordcount $ cd wordcount

More information

Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0,

Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0, http://debut.cis.nctu.edu.tw/~chi Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0, : POSITIVE_INFINITY NEGATIVE_INFINITY

More information

1.JasperReport ireport JasperReport ireport JDK JDK JDK JDK ant ant...6

1.JasperReport ireport JasperReport ireport JDK JDK JDK JDK ant ant...6 www.brainysoft.net 1.JasperReport ireport...4 1.1 JasperReport...4 1.2 ireport...4 2....4 2.1 JDK...4 2.1.1 JDK...4 2.1.2 JDK...5 2.1.3 JDK...5 2.2 ant...6 2.2.1 ant...6 2.2.2 ant...6 2.3 JasperReport...7

More information

SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 "odps-sdk" 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基

SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 odps-sdk 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基 开放数据处理服务 ODPS SDK SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 "odps-sdk" 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基础功能的主体接口, 搜索关键词 "odpssdk-core" 一些

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 1Z0-854 Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Version : Demo 1 / 12 1.Given: 20. public class CreditCard

More information

(TestFailure) JUnit Framework AssertionFailedError JUnit Composite TestSuite Test TestSuite run() run() JUnit

(TestFailure) JUnit Framework AssertionFailedError JUnit Composite TestSuite Test TestSuite run() run() JUnit Tomcat Web JUnit Cactus JUnit Java Cactus JUnit 26.1 JUnit Java JUnit JUnit Java JSP Servlet JUnit Java Erich Gamma Kent Beck xunit JUnit boolean JUnit Java JUnit Java JUnit Java 26.1.1 JUnit JUnit How

More information

使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款

使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款 JAVA 程 序 设 计 ( 肆 ) 徐 东 / 数 学 系 使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款 使 用 Java class 代 表 保 险 箱 public class SaveBox 类 名 类 类 体 实 现 封 装 性 使 用 class SaveBox 代 表 保

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

目 录 实 验 一 : 熟 悉 Java 开 发 环 境... 1 实 验 二 : 类 与 面 向 对 象... 7 实 验 三 : 继 承 和 多 态... 13 实 验 四 : 异 常 处 理... 18 实 验 五 : 流 文 件 及 基 于 文 本 的 应 用... 23

目 录 实 验 一 : 熟 悉 Java 开 发 环 境... 1 实 验 二 : 类 与 面 向 对 象... 7 实 验 三 : 继 承 和 多 态... 13 实 验 四 : 异 常 处 理... 18 实 验 五 : 流 文 件 及 基 于 文 本 的 应 用... 23 Java 程 序 设 计 实 验 指 导 书 商 丘 学 院 计 算 机 科 学 与 技 术 学 院 张 艳 晓 目 录 实 验 一 : 熟 悉 Java 开 发 环 境... 1 实 验 二 : 类 与 面 向 对 象... 7 实 验 三 : 继 承 和 多 态... 13 实 验 四 : 异 常 处 理... 18 实 验 五 : 流 文 件 及 基 于 文 本 的 应 用... 23 实 验

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

《大话设计模式》第一章

《大话设计模式》第一章 第 1 章 代 码 无 错 就 是 优? 简 单 工 厂 模 式 1.1 面 试 受 挫 小 菜 今 年 计 算 机 专 业 大 四 了, 学 了 不 少 软 件 开 发 方 面 的 东 西, 也 学 着 编 了 些 小 程 序, 踌 躇 满 志, 一 心 要 找 一 个 好 单 位 当 投 递 了 无 数 份 简 历 后, 终 于 收 到 了 一 个 单 位 的 面 试 通 知, 小 菜 欣 喜

More information

内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌

内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌 语 言 程 序 设 计 郑 莉 胡 家 威 编 著 清 华 大 学 逸 夫 图 书 馆 北 京 内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌 握 语

More information

Microsoft Word - JAVA Programming Language Homework VI_ans.doc

Microsoft Word - JAVA Programming Language Homework VI_ans.doc JAVA Programming Language Homework VI: Threads & I/O ID: Name: 1. When comparing java.io.bufferedwriter to java.io.filewriter, which capability exists as a method in only one of the two? A. Closing the

More information

2009年9月全国计算机等级考试二级Java真题及答案

2009年9月全国计算机等级考试二级Java真题及答案 2009 年 9 月 全 国 计 算 机 等 级 考 试 二 级 Java 真 题 及 答 案 [ 录 入 者 :NCRE100 时 间 :2009-10-08 19:41:34 作 者 : 来 源 :NCRE100.com 浏 览 :1421 次 ] 2009 年 9 月 全 国 计 算 机 等 级 考 试 二 级 笔 试 试 卷 Java 语 言 程 序 设 计 ( 考 试 时 间 90 分 钟,

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Fortran Algol Pascal Modula-2 BCPL C Simula SmallTalk C++ Ada Java C# C Fortran 5.1 message A B 5.2 1 class Vehicle subclass Car object mycar public class Vehicle extends Object{ public int WheelNum

More information

软件工程文档编制

软件工程文档编制 实训抽象类 一 实训目标 掌握抽象类的定义 使用 掌握运行时多态 二 知识点 抽象类的语法格式如下 : public abstract class ClassName abstract void 方法名称 ( 参数 ); // 非抽象方法的实现代码 在使用抽象类时需要注意如下几点 : 1 抽象类不能被实例化, 实例化的工作应该交由它的子类来完成 2 抽象方法必须由子类来进行重写 3 只要包含一个抽象方法的抽象类,

More information

Learning Java

Learning Java Java Introduction to Java Programming (Third Edition) Prentice-Hall,Inc. Y.Daniel Liang 2001 Java 2002.2 Java2 2001.10 Java2 Philip Heller & Simon Roberts 1999.4 Java2 2001.3 Java2 21 2002.4 Java UML 2002.10

More information

Microsoft Word - newJavaA4.doc

Microsoft Word - newJavaA4.doc P74 拾壹. 基本輸入與輸出 一. 使用的物件 1.Java 的輸入與輸出會使用到 Java.lang 套件中的 System 類別與 Java.io 套件, 其中 Java.io 套件中以 Reader/Writer 與 InputStream/OutputStream 類別最 重要, 前者以字元 (Character) 為導向, 後者以位元組 (Byte) 為導向 2.System 類別中最主要宣告了三個類別物件,System.in

More information

使用MapReduce读取XML文件

使用MapReduce读取XML文件 使用 MapReduce 读取 XML 文件 XML( 可扩展标记语言, 英语 :extensible Markup Language, 简称 : XML) 是一种标记语言, 也是行业标准数据交换交换格式, 它很适合在系统之间进行数据存储和交换 ( 话说 Hadoop H ive 等的配置文件就是 XML 格式的 ) 本文将介绍如何使用 MapReduce 来读取 XML 文件 但是 Had oop

More information

Mac Java import com.apple.mrj.*;... public class MyFirstApp extends JFrame implements ActionListener, MRJAboutHandler, MRJQuitHandler {... public MyFirstApp() {... MRJApplicationUtils.registerAboutHandler(this);

More information

EJB-Programming-3.PDF

EJB-Programming-3.PDF :, JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Value Object Design Pattern J2EE Design Patterns Value Object Value Object Factory J2EE EJB Test Client

More information

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 复习 Protected 可以被子类 / 同一包中的类访问, 不能被其他类访问 弱化的 private 同时赋予 package access class MyType { public int i; public double d; public char

More information

Microsoft PowerPoint - ch7_1 DA class

Microsoft PowerPoint - ch7_1 DA class Quiz 1. Describe the similarities and differences of Tester class and GUI class 2. What is the function of GUI class? 3. What is the function of PD(problem domain) class? 4. How does a GUI class interact

More information

Java 1 Java String Date

Java 1 Java String Date JAVA SCJP Java 1 Java String Date 1Java 01 Java Java 1995 Java Java 21 Java Java 5 1-1 Java Java 1990 12 Patrick Naughton C++ C (Application Programming Interface API Library) Patrick Naughton NeXT Stealth

More information

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1

More information

2009年3月全国计算机等级考试二级Java语言程序设计笔试试题

2009年3月全国计算机等级考试二级Java语言程序设计笔试试题 2009 年 3 月 全 国 计 算 机 等 级 考 试 笔 试 试 卷 二 级 Java 语 言 程 序 设 计 ( 考 试 时 间 90 分 钟, 满 分 100 分 ) 一 选 择 题 ( 每 题 2 分, 共 70 分 ) 下 列 各 题 A) B) C) D) 四 个 选 项 中, 只 有 一 个 选 项 是 正 确 的 请 将 正 确 选 项 填 涂 在 答 题 卡 相 应 位 置 上,

More information

untitled

untitled 4.1AOP AOP Aspect-oriented programming AOP 來說 AOP 令 理 Cross-cutting concerns Aspect Weave 理 Spring AOP 來 AOP 念 4.1.1 理 AOP AOP 見 例 來 例 錄 Logging 錄 便 來 例 行 留 錄 import java.util.logging.*; public class HelloSpeaker

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Java application Java main applet Web applet Runnable Thread CPU Thread 1 Thread 2 Thread 3 CUP Thread 1 Thread 2 Thread 3 ,,. (new) Thread (runnable) start( ) CPU (running) run ( ) blocked CPU sleep(

More information

x MapReduce A Italic URL Constant width Constant width bold Constant width italic 這個圖示代表提示或建議 這個圖示代表一般註解

x MapReduce A Italic URL Constant width Constant width bold Constant width italic 這個圖示代表提示或建議 這個圖示代表一般註解 Java R Python Java Java Java x MapReduce A Italic URL Constant width Constant width bold Constant width italic 這個圖示代表提示或建議 這個圖示代表一般註解 第一章 I/O double[][] int[] String[] List 2 Map JavaScript Object Notation

More information

Swing-02.pdf

Swing-02.pdf 2 J B u t t o n J T e x t F i e l d J L i s t B u t t o n T e x t F i e l d L i s t J F r a m e 21 2 2 Swing C a n v a s C o m p o n e n t J B u t t o n AWT // ToolbarFrame1.java // java.awt.button //

More information

3.1 num = 3 ch = 'C' 2

3.1 num = 3 ch = 'C' 2 Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:

More information

OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点

OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点 复习 Protected 可以被子类 / 同一包中的类访问, 不能被其他类访问 弱化的 private 同时赋予 package access class MyType { public int i; public double d; public

More information

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 复习 Java 包 创建包 : package 语句, 包结构与目录结构一致 使用包 : import restaurant/ - people/ - Cook.class - Waiter.class - tools/ - Fork.class - Table.class

More information

<4D6963726F736F667420576F7264202D20C8EDC9E82DCFC2CEE7CCE22D3039C9CF>

<4D6963726F736F667420576F7264202D20C8EDC9E82DCFC2CEE7CCE22D3039C9CF> 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 考 试 2009 年 上 半 年 软 件 设 计 师 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 请 按 下 述 要 求 正 确 填 写 答 题 纸 1. 在 答 题 纸 的 指 定 位 置 填 写 你 所 在 的 省 自 治 区 直 辖 市 计 划 单 列 市 的 名 称 2. 在 答

More information

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检 2016 年 上 半 年 软 件 设 计 师 考 试 真 题 ( 下 午 题 ) 下 午 试 题 试 题 一 ( 共 15 分 ) 阅 读 下 列 说 明 和 图, 回 答 问 题 1 至 问 题 4, 将 解 答 填 入 答 题 纸 的 对 应 栏 内 说 明 某 会 议 中 心 提 供 举 办 会 议 的 场 地 设 施 和 各 种 设 备, 供 公 司 与 各 类 组 织 机 构 租 用 场

More information

java2d-4.PDF

java2d-4.PDF 75 7 6 G r a d i e n t P a i n t B a s i c S t r o k e s e t P a i n t ( ) s e t S t o r k e ( ) import java.awt.*; import java.awt.geom.*; public class PaintingAndStroking extends ApplicationFrame { public

More information

OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票

OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票 复习 创建对象 构造函数 函数重载 : 函数 = 函数名 + 参数列表 public class MyType { int i; double d; char c; void set(double x)

More information

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 复习 Protected 可以被子类 / 同一包中的类访问, 不能被其他类访问 弱化的 private 同时赋予 package access class MyType { public int i; public double d; public char

More information

untitled

untitled 1 MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/ Object object 參 類 都 object 參 object Boxing 參 boxing

More information

chp7.ppt

chp7.ppt Java 软件设计基础 7. Java 的基本可重用类 1.Java 可重用类的结构 Java 语言中将功能相关的可重用类组织成包, 可重用类的继承层次和包的组织呈树形结构 M L L L L L Java 可重用类按功能可划分为 : java.lang 是 Java 语言的核心包, 主要含有与语言相关的类 ; 提供如基本数据类型处理 基本数值函数 字符串处理 线程 异常处理等基本功能 ; 由解释程序自动加载,

More information

View:Struts 提 供 了 action form 创 建 form bean, 用 于 在 controller 和 view 间 传 输 数 据 此 外,Struts 提 供 了 自 定 义 JSP 标 签 库, 辅 助 开 发 者 用 JSP 创 建 交 互 式 的 以 表 单 为 基

View:Struts 提 供 了 action form 创 建 form bean, 用 于 在 controller 和 view 间 传 输 数 据 此 外,Struts 提 供 了 自 定 义 JSP 标 签 库, 辅 助 开 发 者 用 JSP 创 建 交 互 式 的 以 表 单 为 基 一 你 对 MVC 的 理 解,MVC 有 什 么 优 缺 点? 结 合 Struts, 说 明 在 一 个 Web 应 用 如 何 去 使 用? 答 : MVC 设 计 模 式 ( 应 用 观 察 者 模 式 的 框 架 模 式 ) M: Model(Business process layer), 模 型, 操 作 数 据 的 业 务 处 理 层, 并 独 立 于 表 现 层 (Independent

More information

詞 彙 表 編 號 詞 彙 描 述 1 預 約 人 資 料 中 文 姓 名 英 文 姓 名 身 份 證 字 號 預 約 人 電 話 性 別 2 付 款 資 料 信 用 卡 別 信 用 卡 號 信 用 卡 有 效 日 期 3 住 房 條 件 入 住 日 期 退 房 日 期 人 數 房 間 數 量 入

詞 彙 表 編 號 詞 彙 描 述 1 預 約 人 資 料 中 文 姓 名 英 文 姓 名 身 份 證 字 號 預 約 人 電 話 性 別 2 付 款 資 料 信 用 卡 別 信 用 卡 號 信 用 卡 有 效 日 期 3 住 房 條 件 入 住 日 期 退 房 日 期 人 數 房 間 數 量 入 100 年 特 種 考 試 地 方 政 府 公 務 人 員 考 試 試 題 等 別 : 三 等 考 試 類 科 : 資 訊 處 理 科 目 : 系 統 分 析 與 設 計 一 請 參 考 下 列 旅 館 管 理 系 統 的 使 用 案 例 圖 (Use Case Diagram) 撰 寫 預 約 房 間 的 使 用 案 例 規 格 書 (Use Case Specification), 繪 出 入

More information

untitled

untitled 1 Outline ArrayList 類 列類 串類 類 類 例 理 MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/ Object object

More information

RUN_PC連載_12_.doc

RUN_PC連載_12_.doc PowerBuilder 8 (12) PowerBuilder 8.0 PowerBuilder PowerBuilder 8 PowerBuilder 8 / IDE PowerBuilder PowerBuilder 8.0 PowerBuilder PowerBuilder PowerBuilder PowerBuilder 8.0 PowerBuilder 6 PowerBuilder 7

More information

内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指

内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指 内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指 导 你 搭 建 Linux 平 台 下 的 JAVA 开 发 环 境, 包 括 JDK 以 及 集

More information

FileMaker 16 ODBC 和 JDBC 指南

FileMaker 16 ODBC 和 JDBC 指南 FileMaker 16 ODBC JDBC 2004-2017 FileMaker, Inc. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker FileMaker Go FileMaker, Inc. FileMaker WebDirect FileMaker Cloud FileMaker,

More information

Microsoft Word - 投影片ch13

Microsoft Word - 投影片ch13 Java2 JDK5.0 教學手冊第三版洪維恩編著博碩文化出版書號 pg20210 第十三章例外處理 本章學習目標了解什麼是例外處理認識例外類別的繼承架構認識例外處理的機制學習如何撰寫例外類別 例外處理 13-2 13.1 例外的基本觀念 在執行程式時, 經常發生一些不尋常的狀況 例如 : (1) 要開啟的檔案不存在 (2) 陣列的索引值超過了陣列容許的範圍 (3) 使用者輸入錯誤 Java 把這類不尋常的狀況稱為

More information

处理基本数据类型 Buffer 内幕 内存映像文件 性能 文件锁闭 压缩 生成 GZIP 压缩文件 对象串行化 恢复对象 正则表达式 生成正则表达式... 41

处理基本数据类型 Buffer 内幕 内存映像文件 性能 文件锁闭 压缩 生成 GZIP 压缩文件 对象串行化 恢复对象 正则表达式 生成正则表达式... 41 第十三讲 Java I/O 系统 他应该瞪大眼睛盯着诺亚, 好好学习一下, 看他们是怎样把那么多东西装到一个小小的方舟上的 西德尼 十三 Java I/O 系统 第十三讲 Java I/O 系统... 1 1. 类 File... 3 列出文件夹的文件清单... 3 检查文件夹, 生成文件夹... 4 2. 输入输出... 6 InputStream 的类别...6 OutputStream 的类别...

More information

Microsoft PowerPoint - string_kruse [兼容模式]

Microsoft PowerPoint - string_kruse [兼容模式] Strings Strings in C not encapsulated Every C-string has type char *. Hence, a C-string references an address in memory, the first of a contiguous set of bytes that store the characters making up the string.

More information

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074>

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074> 程 序 设 计 实 习 INFO130048 3-2.C++ 面 向 对 象 程 序 设 计 重 载 继 承 多 态 和 聚 合 复 旦 大 学 计 算 机 科 学 与 工 程 系 彭 鑫 pengxin@fudan.edu.cn 内 容 摘 要 方 法 重 载 类 的 继 承 对 象 引 用 和 拷 贝 构 造 函 数 虚 函 数 和 多 态 性 类 的 聚 集 复 旦 大 学 计 算 机 科 学

More information

FileMaker 15 ODBC 和 JDBC 指南

FileMaker 15 ODBC 和 JDBC 指南 FileMaker 15 ODBC JDBC 2004-2016 FileMaker, Inc. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker FileMaker Go FileMaker, Inc. / FileMaker WebDirect FileMaker, Inc. FileMaker

More information

Microsoft Word - Learn Objective-C.doc

Microsoft Word - Learn Objective-C.doc Learn Objective C http://cocoadevcentral.com/d/learn_objectivec/ Objective C Objective C Mac C Objective CC C Scott Stevenson [object method]; [object methodwithinput:input]; output = [object methodwithoutput];

More information

OOP with Java 通知 Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢 学习使用文本编辑器 学习使用 cmd: Power shell 阅读参考资料

OOP with Java 通知 Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢   学习使用文本编辑器 学习使用 cmd: Power shell 阅读参考资料 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢 Email: 51141201063@ecnu.cn 学习使用文本编辑器 学习使用 cmd: Power shell 阅读参考资料 OOP with Java Java 类型 引用 不可变类型 对象存储位置 作用域 OOP

More information

mvc

mvc Build an application Tutor : Michael Pan Application Source codes - - Frameworks Xib files - - Resources - ( ) info.plist - UIKit Framework UIApplication Event status bar, icon... delegation [UIApplication

More information

Microsoft Word - 投影片ch14

Microsoft Word - 投影片ch14 Java2 JDK5.0 教學手冊第三版洪維恩編著博碩文化出版書號 pg20210 第十四章檔案處理 本章學習目標認識串流學習檔案的開啟與關閉學習如何處理文字檔學習如何處理二進位檔 檔案處理 14-2 14.1 關於串流 串流可分為 輸入串流 (input stream) 與 輸出串流 (output stream) 兩種 下圖說明了串流如何做為檔案處理的橋樑 : stream 資料 input stream

More information

javaexample-02.pdf

javaexample-02.pdf n e w. s t a t i c s t a t i c 3 1 3 2 p u b l i c p r i v a t e p r o t e c t e d j a v a. l a n g. O b j e c t O b j e c t Rect R e c t x 1 y 1 x 2 y 2 R e c t t o S t r i n g ( ) j a v a. l a n g. O

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2008 年 上 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 试 题 一 ( 共 15 分 ) 阅 读 以 下 说 明 和 流 程 图, 填 补 流 程 图 中 的 空 缺 (1)~(9), 将 解 答 填 入 答 题 纸 的 对 应 栏 内 [ 说 明

More information

untitled

untitled JavaEE+Android - 6 1.5-2 JavaEE web MIS OA ERP BOSS Android Android Google Map office HTML CSS,java Android + SQL Sever JavaWeb JavaScript/AJAX jquery Java Oracle SSH SSH EJB+JBOSS Android + 1. 2. IDE

More information

2 Java 语 言 程 序 设 计 教 程 1.2.1 简 单 性 Java 语 言 的 语 法 与 C 语 言 和 C++ 语 言 很 接 近, 使 得 大 多 数 程 序 员 很 容 易 学 习 和 使 用 Java 另 一 方 面,Java 丢 弃 了 C++ 中 很 少 使 用 的 很 难

2 Java 语 言 程 序 设 计 教 程 1.2.1 简 单 性 Java 语 言 的 语 法 与 C 语 言 和 C++ 语 言 很 接 近, 使 得 大 多 数 程 序 员 很 容 易 学 习 和 使 用 Java 另 一 方 面,Java 丢 弃 了 C++ 中 很 少 使 用 的 很 难 第 1 章 Java 概 述 Java 的 诞 生 Java 的 特 点 Java 开 发 环 境 安 装 与 配 置 创 建 并 运 行 一 个 简 单 的 Java 程 序 Java 语 言 是 当 今 计 算 机 软 件 行 业 中 最 热 门 的 网 络 编 程 语 言, 以 Java 为 核 心 的 芯 片 技 术 编 译 技 术 数 据 库 连 接 技 术, 以 及 基 于 企 业 级

More information

Microsoft Word - 新1-12.doc

Microsoft Word - 新1-12.doc 实训 5 面向对象编程练习 实训 5 面向对象编程练习 5.1 实训目的 通过编程和上机实验理解 Java 语言是如何体现面向对象编程基本思想 以及如何创建类 和对象 了解成员变量和成员方法的特性 5.2 实训要求 编写一个体现面向对象思想的程序 编写一个创建对象和使用对象的方法的程序 5.3 实训内容 5.3.1 创建对象并使用对象 1 定义一个 Person 类 可以在应用程序中使用该类 成员属性

More information

无类继承.key

无类继承.key 无类继承 JavaScript 面向对象的根基 周爱 民 / aimingoo aiming@gmail.com https://aimingoo.github.io https://github.com/aimingoo rand = new Person("Rand McKinnon",... https://docs.oracle.com/cd/e19957-01/816-6408-10/object.htm#1193255

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

untitled

untitled 1 Outline 料 類 說 Tang, Shih-Hsuan 2006/07/26 ~ 2006/09/02 六 PM 7:00 ~ 9:30 聯 ives.net@gmail.com www.csie.ntu.edu.tw/~r93057/aspnet134 度 C# 力 度 C# Web SQL 料 DataGrid DataList 參 ASP.NET 1.0 C# 例 ASP.NET 立

More information

D C 93 2

D C 93 2 D9223468 3C 93 2 Java Java -- Java UML Java API UML MVC Eclipse API JavadocUML Omendo PSPPersonal Software Programming [6] 56 8 2587 56% Java 1 epaper(2005 ) Java C C (function) C (reusability) eat(chess1,

More information

附录J:Eclipse教程

附录J:Eclipse教程 附 录 J:Eclipse 教 程 By Y.Daniel Liang 该 帮 助 文 档 包 括 以 下 内 容 : Eclipse 入 门 选 择 透 视 图 创 建 项 目 创 建 Java 程 序 编 译 和 运 行 Java 程 序 从 命 令 行 运 行 Java Application 在 Eclipse 中 调 试 提 示 : 在 学 习 完 第 一 章 后 使 用 本 教 程 第

More information

Microsoft Word - 11.doc

Microsoft Word - 11.doc 除 錯 技 巧 您 將 於 本 章 學 到 以 下 各 項 : 如 何 在 Visual C++ 2010 的 除 錯 工 具 控 制 下 執 行 程 式? 如 何 逐 步 地 執 行 程 式 的 敘 述? 如 何 監 看 或 改 變 程 式 中 的 變 數 值? 如 何 監 看 程 式 中 計 算 式 的 值? 何 謂 Call Stack? 何 謂 診 斷 器 (assertion)? 如 何

More information

Microsoft PowerPoint - course2.ppt

Microsoft PowerPoint - course2.ppt Java 程 式 設 計 基 礎 班 (2) 莊 坤 達 台 大 電 信 所 網 路 資 料 庫 研 究 室 Email: doug@arbor.ee.ntu.edu.tw Class 2 1 回 顧 Eclipse 使 用 入 門 Class 2 2 Lesson 2 Java 程 式 語 言 介 紹 Class 2 3 Java 基 本 知 識 介 紹 大 小 寫 有 差 (Case Sensitive)

More information

JAVA 单元 2.1 四则运算机 ( 一 ) 单元教学进度设计 教学环节 教学内容 教师学生活动活动 反馈 反馈课前作业完成情况 反馈加分 1. 下面哪些是合法的变量名? ( ) A.2variable 答案 :DEG B..variable2 解答 : C.._whatavariable A:/

JAVA 单元 2.1 四则运算机 ( 一 ) 单元教学进度设计 教学环节 教学内容 教师学生活动活动 反馈 反馈课前作业完成情况 反馈加分 1. 下面哪些是合法的变量名? ( ) A.2variable 答案 :DEG B..variable2 解答 : C.._whatavariable A:/ 单元 2.1 四则运算机 ( 一 ) 单元教学进度设计 教学环节 教学内容 教师学生活动活动 反馈 反馈课前作业完成情况 反馈加分 1. 下面哪些是合法的变量名? ( ) A.2variable 答案 :DEG B..variable2 解答 : C.._whatavariable A:// 不能以数字开头 D._3_ B:// 不能用点和空格 提问 抢答 E.$anothervar C: // 不能用点和空格

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

Microsoft PowerPoint - 06.ppt

Microsoft PowerPoint - 06.ppt 楚广明 C# 简明教程 Email:chu888chu888@Gmail.com Blog:http://www.cnblogs.com/chu888chu888 楚广明 C# 简明教程第 1 页版本 V1.0 1 Module 6: Input/Output 楚广明 C# 简明教程第 2 页版本 V1.0 2 Review 在这一章中, 我们将主要学习如何使用 Microsoft.NET FrameWork

More information

JBuilder Weblogic

JBuilder Weblogic JUnit ( bliu76@yeah.net) < >6 JUnit Java Erich Gamma Kent Beck JUnit JUnit 1 JUnit 1.1 JUnit JUnit java XUnit JUnit 1.2 JUnit JUnit Erich Gamma Kent Beck Erich Gamma Kent Beck XP Extreme Programming CRC

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

内容介绍 6.1 任务预览 6.2 异常 6.3 异常种类与层次结构 6.4 异常处理代码块 try-catch-finally 6.5 throw 语句与 throws 子句 6.6 自定义异常类 6.7 异常处理代码块嵌套 6.8 错误与断言 6.9 本章小结 6.10 实训 6: 除法运算程序

内容介绍 6.1 任务预览 6.2 异常 6.3 异常种类与层次结构 6.4 异常处理代码块 try-catch-finally 6.5 throw 语句与 throws 子句 6.6 自定义异常类 6.7 异常处理代码块嵌套 6.8 错误与断言 6.9 本章小结 6.10 实训 6: 除法运算程序 第 6 章除法运算 异常处理 能力目标 : 学会使用 try-catch-finally 代码块处理异常 学会使用 throw 语句主动抛出异常, 使用 throws 子句从方法声明中抛出异常 理解自定义异常类, 了解断言语句 能运用异常处理机制编写整数 实数除法运算程序 内容介绍 6.1 任务预览 6.2 异常 6.3 异常种类与层次结构 6.4 异常处理代码块 try-catch-finally

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc 2 5 8 11 0 1. 13 2. 15 3. 18 1 1. 22 2. 25 3. 27 2 1. 35 2. 38 3. 41 4. 43 5. 48 6. 50 3 1. 56 2. 59 3. 63 4. 65 5. 69 13 22 35 56 6. 74 7. 82 8. 84 9. 87 10. 97 11. 102 12. 107 13. 111 4 114 1. 114 2.

More information

C H A P T E R 7 Windows Vista Windows Vista Windows Vista FAT16 FAT32 NTFS NTFS New Technology File System NTFS

C H A P T E R 7 Windows Vista Windows Vista Windows Vista FAT16 FAT32 NTFS NTFS New Technology File System NTFS C H P T E R 7 Windows Vista Windows Vista Windows VistaFT16 FT32NTFS NTFSNew Technology File System NTFS 247 6 7-1 Windows VistaTransactional NTFS TxFTxF Windows Vista MicrosoftTxF CIDatomicity - Consistency

More information

《面向对象程序设计A》课程教学大纲Ⅱ4

《面向对象程序设计A》课程教学大纲Ⅱ4 Java 程 序 设 计 课 程 教 学 大 纲 Ⅱ5 课 程 代 码 : 课 程 名 称 :Java 程 序 设 计 Java Programming 学 分 :5 总 学 时 :80 ( 其 中 : 理 论 学 时 :48 实 验 ( 上 机 ) 学 时 :32) 先 修 课 程 : 2106010190 大 学 计 算 机 信 息 技 术 基 础 适 用 对 象 : 本 二 工 科 非 计 算

More information

[Short Essay:] 1. (5 points) Use state-of-memory diagram to describe the differences between x and y declared as follows: double[] x = new double[4];

[Short Essay:] 1. (5 points) Use state-of-memory diagram to describe the differences between x and y declared as follows: double[] x = new double[4]; Introduction to Programming (II) Spring 2008, Final Exam Name: ID Number: [True/False:] (5 points each) If your answer is "false", you have to provide correct reasons. Otherwise, no points will be given.

More information

OOP with Java 通知 : Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢

OOP with Java 通知 : Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 : Project 2 提交时间 : 3 月 14 日晚 9 点 另一名助教 : 王桢 Email: 51141201063@ecnu.cn 复习 : Java 类型 基本类型 boolean, char, 封装 (wrappers) 类 (class) 定义 class MyType { int i;

More information

OOP with Java 通知 : Project 2 提交时间 : 3 月 15 日晚 9 点

OOP with Java 通知 : Project 2 提交时间 : 3 月 15 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 : Project 2 提交时间 : 3 月 15 日晚 9 点 复习 : Java 类型 基本类型 boolean, char, 封装 (wrappers) 类 (class) 定义 class MyType { int i; double d; 数据 (Fields) char c; void set(double

More information

2/14 Buffer I12, /* x=2, buffer = I 1 2 */ Buffer I243, /* x=34, buffer = I 2 43 */ x=56, buffer = I243 Buffer I243I265 code_int(int x, char *buffer)

2/14 Buffer I12, /* x=2, buffer = I 1 2 */ Buffer I243, /* x=34, buffer = I 2 43 */ x=56, buffer = I243 Buffer I243I265 code_int(int x, char *buffer) 1/14 IBM Rational Test RealTime IBM, 2004 7 01 50% IBM Rational Test RealTime IBM Rational Test RealTime 1. 50% IBM Rational Test RealTime IBM Rational Test RealTime 2. IBM Rational Test RealTime Test

More information