example7_2.java

来自「《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌」· Java 代码 · 共 43 行

JAVA
43
字号
/*
 * Example7_2.java
 *
 * Created on 2006年9月15日, 下午4:53
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package example7_2;
import java.io.*;
/**
 *
 * @author Administrator
 */
public class Example7_2 {
    
    /** Creates a new instance of Example7_2 */
    public Example7_2() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException{
        // TODO code application logic here
   String tmp = "abc";
  byte b[] = tmp.getBytes();   //数据源
  ByteArrayInputStream in = new ByteArrayInputStream(b);  //创建字节数组流对象
  for (int i=0; i<2; i++) {
   int c;
   while ((c = in.read()) != -1) {
    if (i == 0) { System.out.print((char) c);} 
    else {System.out.print(Character.toUpperCase((char) c));}
   }
   System.out.println();
   in.reset();
  }
 
    }
    
}

⌨️ 快捷键说明

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