📄 listjava.java
字号:
import java.io.*;
public class ListJava extends Object
{
public static void main(String[] args)
{
// Create a File instance for the current directory
File currDir = new File(".");
// Get a filtered list of the .java files in the current directory
String[] javaFiles = currDir.list(new JavaFilter());
// Print out the contents of the javaFiles array
for (int i=0; i < javaFiles.length; i++) {
System.out.println(javaFiles[i]);
}
}
}
// This class implements a filename filter that only allows
// files that end with .java
class JavaFilter extends Object implements FilenameFilter
{
public JavaFilter()
{
}
public boolean accept(File dir, String name)
{
// Only return true for accept if the file ends with .java
return name.endsWith(".class");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -