filedemo8.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 24 行

JAVA
24
字号
/**
*Another simple file demostration program
*Reads the source code from the disk and displays the code on the screen

*/

import java.io.*;

class fileDemo8
{
	public static void main(String args[]) throws IOException
	{
		byte[] b = new byte[800];
		FileInputStream fin = new FileInputStream("fileDemo8.java");
		int bytes = fin.read(b,0,800);
		String str = new String(b,0,bytes);
	/*-------------------------------------------------------------------------------
	 	public String(byte[] bytes, int start, int count)
		This constructor creates a new String,which value equals to the String from
		the "start" location in the "byte[]",and lasts for "count" characters
	-------------------------------------------------------------------------------*/
		System.out.println(str);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?