文件名字为:c.txt其中的数据有重复的,比如数据为:01104116011040890110409701104099011041150110411101104099希望通过程序找出,下面是我写的,有错误packageFile;importjava.io.B...
文件名字为:c.txt
其中的数据有重复的,比如数据为:
01104116
01104089
01104097
01104099
01104115
01104111
01104099
希望通过程序找出,下面是我写的,有错误
package File;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class BR {
public static void main(String[] args) {
try{
String a[]=new String[7403];
FileReader fr=new FileReader("F://c.txt");
BufferedReader br=new BufferedReader(fr);
String aline;
int i=0;
while((aline=br.readLine())!=null){
String str=new String(aline);
a[i]=aline;
i++;
}
// for(int j=0;j
// System.out.println(a[j]);
// }
for( i=0;i
for(int j=0;j
while(a[i]!=null&&a[j]!=null){
if(a[i].equals(a[j])&&i!=j){
System.out.println(a[i]);
}
}
}
}
}catch(IOException e){
e.printStackTrace();
}
}
}
谁帮我写一下用集合实现的,谢谢了。