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

📄 scannerexp.java

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

import java.io.*;
import java.util.*;

public class ScannerExp {
        
    /**
     * Creates a new instance of <code>ScannerExp</code>.
     */
    public ScannerExp() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
   try {
   	FileInputStream  inStream;
   	Scanner  inScan;
   	inStream=new FileInputStream("4.txt");
   	inScan=new Scanner(inStream);
   	while (inScan.hasNext()) {
   	 if (inScan.hasNextBoolean())
   	  System.out.println("Boolean value:"+inScan.nextBoolean());
   	  else if (inScan.hasNextLong())
   	   System.out.println("Integer value:"+inScan.nextLong());
   	  else if (inScan.hasNextDouble())
   	   System.out.println("Double value:"+inScan.nextDouble());
   	  else 
   	   System.out.println("String value:"+inScan.next());   	   
   	}
   	inScan.close();
   }
   catch (IOException e) {
    System.out.println("ERROR reading.");
   }
   
    
    }
}

⌨️ 快捷键说明

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