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

📄 example7_1.java

📁 《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌-源程序
💻 JAVA
字号:
/*
 * Example7_1.java
 *
 * Created on 2006年10月19日, 上午9:12
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package example7_1;
import java.io.IOException;

/**
 *
 * @author Administrator
 */
public class Example7_1 {
    
    /** Creates a new instance of Example7_1 */
    public Example7_1() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("请输入:");
		byte buffer[] = new byte[512];   		// 输入缓冲区域
		int count;
		try {	count = System.in.read(buffer);   // 读取标准输入流
			System.out.println("实际读入的字节数目:" + count);
			System.out.println("输出结果:");
			// 直接输出buffer元素值
			for (int i = 0; i < count; i++) {	System.out.print(buffer[i] + " ");}
			System.out.println();
			// 以char方式输出buffer
			for (int i = 0; i < count; i++) {	System.out.print((char) buffer[i]);}
		  } catch (IOException e)
                  {	e.printStackTrace();
                  }
    }
    
}

⌨️ 快捷键说明

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