main.java
来自「在一个n*n 矩阵中找到 沿着八个方向搜索」· Java 代码 · 共 30 行
JAVA
30 行
package cn.edu.nju.software.puzzle;
import java.io.File;
import java.io.IOException;
import java.util.Set;
public class Main {
public static void main(String[] args) throws IOException {
File squareFile = new File("square.txt");
File dictFile = new File("dict.txt");
if (squareFile.exists() && dictFile.exists()) {
WordPuzzle puzzle = new WordPuzzle(squareFile, dictFile);
Set<String> words = puzzle.find();
if (words != null) {
for (String word : words) {
System.out.println(word);
}
}
else {
System.out.println("No word found!");
}
} else{
System.err.println("Input file missing!");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?