📄 load.java~6~
字号:
package test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Iterator;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.ArrayList;
public class Load {
String path;//文件的路径
String[] all;
List l;
File file;
BufferedReader br;
String[] content;
String temp;
public Load(String path){
this.path = path;
try {
l = new ArrayList();
file = new File("C:/d.txt");
br = new BufferedReader(new FileReader(file));
} catch (Exception e) {
}
}
public void getContent(){
File file = new File(path);
}
public String[] allContent(){//导入文件中的所有内容
return all;
}
}
/*package rc;
import java.io.*;
import java.util.*;
public class Load {
List l;
File file;
BufferedReader br;
String[] content;
String temp;
public Load(){
try{
l = new ArrayList();
file = new File("C:/d.txt");
br = new BufferedReader(new FileReader(file));
}
catch(Exception e){
}
}
public String[] contents(){
try {
while ((temp = br.readLine()) != null) {
l.add(temp);
}
}
catch (Exception e) {
}
String[] re = new String[l.size()];
Iterator it = l.iterator();
int i = 0;
while(it.hasNext()){
re[i++] = ((String)it.next()).trim();
}
return re;
}
public static void main(String args[]){
Load l = new Load();
String[] all = l.contents();
for(int i = 0; i < all.length; i++){
System.out.println("第 "+ i + " 个 : 是 " + all[i]);
}
System.out.println("length:"+all[0].length());
String s1 = all[0];
for(int i = 1; i < all.length; i++){
if(all[i].startsWith("-a ")){
System.out.println("-a : have these : --> " + all[i].substring(3));
}
}
}
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -