---恢复内容开始---java
在一个类中定义的另外一个类称为内部类 ·内部类的外嵌类的成员变量在内部类中仍然有效 ·类体中不能够声明类变量和类方法 ·内部类仅供外嵌类使用
建立子类对象时,除了使用父类的构造方法外还有类体 ·能够继承重写父类方法 ·使用时直接用匿名类建立对象 ·能够访问外嵌类中的成员变量和方法 ·直接使用父类的构造方法
容许定义方法时声明该方法调用过程当中可能出现的异常 try-catch语句 try部分抛出异常对象,catch处理异常
使用关键字assert声明一条断言语句 assert booleanExpression; 启用断言语句 java -ea mainClass
·文件的属性 ·目录的建立,列出文件目录 ·文件的建立与删除 File file =new File(“C:\\myletter",""letter.txt"); file.delete() ·运行可执行文件 Runtime ec; ec = Runtime.getRuntime();
·构造方法 FileInputStream(String name); FileInputStream(File file); ·使用输入流读取字节 int read() int read(byte b[]) int read(byte b[],int off,int len)
·构造方法 FileOutputStream(String name); FileOutputStream(File file); ·使用输出流写字节 void write(int n) void write(byte b[]) void write(byte b[],int off,int len) void close() 关闭输出流
·构造方法 FileReader (String filename); FileWriter (String filename);
·构造方法 BufferedReader(Reader in); BufferedWriter(Writer out);
·构造方法 RandomAccessFile(String name,String mode) RandomAccessFile(File file,String mode)
·字节数组流 ByteArrayInputStream(byte[] buf); ByteArrayInputStream (byte buf,int offset,int length); ByteArrayOutputStream(byte[] buf); ByteArrayOutputStream (byte buf,int offset,int length); ·字符数组流
·构造方法 DataInputStream(InputStream in) DataOutputStream(OutputStream out)
·构造方法 ObjectInputStream(InputStream in) ObjectOutputStream(Output out)
·一个类的两个对象具备相同的引用,他们具备相同的实体功能 A one = new A(); A two = one;
·使用默认分隔标记解析文件 File file = new File(“Hello.java”); Scanner sc = new Scanner(file); ·使用正则表达式做为分隔标记解析文件 File file = new File(“Hello.java”); Scanner sc = new Scanner(file); sc.useDelimiter(正则表达式);
·调用 showSaveDialog(Component a); showOpenDialog(Component a);
·构造方法 ProgressMonitorInputStream(Component c,String s,InputStream);
·步骤 先使用随机流创建指向文件的流对象 getChannel得到一个链接到底层文件的对象 tryLock得到一个FileLock对象,称对文件加锁
连接:https://gitee.com/sq943997011/BESTI.IS.Java2018 截图: