---恢復內容開始---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 截圖:![](https://images2018.cnblogs.com/blog/1296864/201804/1296864-20180401124053207-1713247520.png)