java例程练习(打印流)

摘要: import java.util.*;import java.io.*;//简单的日志功能public class Test { public static void main(String[] args) { String s = null; BufferedReader br = new BufferedReader ( new InputStreamReader(System.in));//标准输入 try { FileWriter fw = new FileWriter("C:/java/logfile.txt",true); PrintWr... 阅读全文
posted @ 2012-05-03 22:17 Yours风之恋 阅读(158) 评论(0) 推荐(0)

java例程练习(数据流)

摘要: import java.io.*;public class Test { public static void main(String[] args) { // 字节数组(内存)--------baos----===>==dos===>===程序 ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); System.out.println(bais.available());//可以读的字节数 DataInputStream dis = new DataInp... 阅读全文
posted @ 2012-05-03 21:01 Yours风之恋 阅读(172) 评论(0) 推荐(0)

java例程练习(转换流)

摘要: import java.io.*;public class Test { public static void main(String[] args) { try { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("C:/java/char.txt")); osw.write("microsoftibssunapplehp"); System.out.println(osw.getEncoding());//文本编码 osw.close(); //加了true 可 阅读全文
posted @ 2012-05-03 20:24 Yours风之恋 阅读(162) 评论(0) 推荐(0)

java例程练习(东软笔试题[n阶平面魔方])

摘要: import java.util.Scanner;public class MoFang { public static void main(String[] args) { System.out.println("输入行(列)数:"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] a = new int[n][n]; int i = 0; int j = n / 2; //算法精要 for (int k = 1; k <= n * n; k++) { a[i][j] = k; 阅读全文
posted @ 2012-05-03 19:52 Yours风之恋 阅读(199) 评论(1) 推荐(0)