文件名称:HowManyTimes
-
所属分类:
- 标签属性:
- 上传时间:2013-03-16
-
文件大小:527byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
1. 使用文件howmanytimes.dat来记录程序HowManyTimes.java的运行次数。编一个程序HowManyTimes.java,它先检查文件howmanytimes.dat是否存在,如果文件不存在,则显示“第1次运行”,创建该文件,在文件中写进整数1,关闭文件;如果文件已存在,则从文件中读取已运行的次数k,显示当前是第k+1次运行,从文件的File对象读取文件上次修改的时间并显示,用seek方法把文件读写位置移到文件头,写进整数k+1,关闭文件。要求运行效果如下图所示:-1 use file howmanytimes.dat to to record the program HowManyTimes.java the number of runs. Compiled a program HowManyTimes.java, it first checks file howmanytimes.dat exists, if the file does not exist, then the 1st run, create the file integer 1, written in the file, close the file if the file already exists read from the file number of runs k is the first k+1 run, from the File object to read the file was last modified time and seek methods to the location of the file read and write over the file header, written the integer k+1, close the file. Run effect as shown below:
(系统自动生成,下载前可以参看下载内容)
下载文件列表
HowManyTimes.java
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.