⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileinputexample.java

📁 Java课堂练习
💻 JAVA
字号:
/**
 * @(#)FileInputExample.java
 *
 *
 * @author 
 * @version 1.00 2007/11/25
 */
import  java.io.*;

public class FileInputExample {
        
    /**
     * Creates a new instance of <code>FileInputExample</code>.
     */
    public FileInputExample() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
      byte  fileContent[]=new byte[20];
      int b;
      try {
       File f=new File("ButtonLabelExp.java");
       FileInputStream in=new FileInputStream(f);
       while ((b=in.read(fileContent,0,20))!=-1)  {
       	String s=new String(fileContent,0,b);
       	System.out.println(s);
       }
       in.close();
      }
      catch (IOException e) {
      	System.out.println("error occured in file read!"+e);
      }
    }

    }

⌨️ 快捷键说明

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