摘要: I/O中的核心类: 一、字节流 InputStream ---抽象类 FileInputStream OutputStream ---抽象类 FileOutputstream InputStream: int read(byte[] b, int off, int len) 返回值是实际读入的字节数 off是偏移量,len是最多读入的字节数 构造器中参数使用文件的全路径 OutputStrea... 阅读全文
posted @ 2012-02-27 13:37 哈哈开心 阅读(145) 评论(0) 推荐(0)
摘要: 1、工厂设计模式 用来生产类对象,避免用户直接接触派生类 给出一个例子: 接口:Teacherinterface Teacher{ public void teach();}class EnglishTeacher implements Teacher{ public void teach(){ System.out.println("上英语课"); }}class MathTeacher im... 阅读全文
posted @ 2012-02-27 13:27 哈哈开心 阅读(169) 评论(0) 推荐(0)