摘要:
【案例1】创建一个新文件importjava.io.*; classhello{ publicstaticvoidmain(String[]args){ Filef=newFile("D:\\hello.txt"); try{ f.createNewFile(); }catch(Exceptione){ e.printStackTrace(); } } }【运行结果】:程序运行之后,在d盘下会有一个名字为hello.txt的文件。【案例2】File类的两个常量importjava.io.*; classhello{ publicstaticvoidmain(String[] 阅读全文
posted @ 2012-01-18 17:50
hnrainll
阅读(388)
评论(0)
推荐(0)
摘要:
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Test{ public static void main(String args[]){ System.out.print("请输入内容:"); /* * 获取键盘输入方法一 Scanner input = new Scanner(System.in); String s = input.nextLin... 阅读全文
posted @ 2012-01-18 17:02
hnrainll
阅读(5512)
评论(0)
推荐(0)