用大大的方式去寫好像也不太對耶
我的程式碼
語法:
import java.io.*;
public class cc
{
// 主程式
public static void main(String[] args) throws Exception
{
String file = "logFile2.drc";
// 建立File物件
File name = new File(file);
if ( name.exists() )
{
// 建立BufferedReader的輸入串流物件
BufferedReader fr = new BufferedReader(new FileReader(name));
String str;
int bao;
while ((str = fr.readLine()) != null)
{
String[] s = str.split(">");//將字串以空白做區隔 存入陣列
//System.out.println(s[1]+" ");
bao= new Integer(s[1]);
System.out.println("數字:"+bao+" ");
for (int i=0;i<=60;i++)
{
if (bao!=i)
System.out.println(i+1);
}
}
fr.close(); // 關閉串流
}
else
System.out.println("檔案[" + name + "不存在!");
}
}
我讀取的TXT資料
語法:
1
2
3
4
.
.
.
50
55
.
.
.
60
其中我把50~55給刪掉