版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_40567229/article/details/86020286
class hello {
public static void main(String[] args) throws ParseException {
File dir = new File("C:\\Users\\Lee\\Pictures\\Saved Pictures");
String arr[] = dir.list();
for (String string : arr) {
if(string.endsWith(".jpg"))
System.out.println(string);
}
}
运行结果: