第一种:File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f); 结果: C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin 获取当前类的所在工程路径; 如果不加“/” File f = new File(this.getClass().getResource("")
第一种: File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f); 结果: C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin 获取当前类的所在工程路径; 如果不加"/" File f = new File(this.getClass().getResource(&q
public class List1 { public static void main(String[] args) { String s = "abc nnn ooo/xzsxc bs"; System.out.println("原字符串:"+ s + "\n"); //把s字符串变成ss数组,然后根据空格截取字符串 String[] ss = s.split(" "); //把数组放进list里面,进行遍历,把数组里的每
public class List { public static void main(String[] args) { String s = "abc nnn ooo/xzsxc bs"; System.out.println("原字符串:"+s); System.out.println(); String a[] = s.split(" "); ArrayList b = new ArrayList(); for (int i = 0; i