javadoc的使用以及打印命令行参数的程序

来源:互联网 发布:蓝小雨的真实身份 知乎 编辑:程序博客网 时间:2024/06/04 19:19

利用注释生成文档

myeclipse中,javadoc的使用  export-->javadoc-->路径 


打印命令行获得的参数  利用随机流(RandomAccessFile)读写,先全部输入到终端,再写入文件(.txt),然后读取(scanner)。

public static void main(String[] args) {


        for (int i = 0; i < args.length; i++) {
System.out.println(args[i]);
}

RandomAccessFile inAndOut = null;
String str;
Scanner sc;
String str1;
try {
File file = new File("file.txt");
file.createNewFile();
inAndOut = new RandomAccessFile("file.txt", "rw");
sc = new Scanner(System.in);//ɨ�������ַ�
while (!(str = sc.nextLine()).equals("exit")) {
inAndOut.writeChars(str);
inAndOut.writeChars("\n");
}

long position = 0;
inAndOut.seek(0);//�ܵ��ļ��ʼ
while (position < inAndOut.length()) {

str1 = inAndOut.readLine();

position = inAndOut.getFilePointer();
System.out.println(str1);

}
inAndOut.close();

}

catch (IOException e) {
}


}

原创粉丝点击