Debugging a programming problem, I found that I did not master the debugging skills, it was really troublesome, so I made a summary to facilitate future review.
Run to Cursor
Jump to the cursor, which is suitable for quickly skipping the cycle and locating to the cursor without breaking the breakpoint everywhere, using breakpoint jump. A very useful function.
Rrop Frame
When debugging a program, have you ever skipped the piece of code you want to analyze in depth because you clicked "Next" too quickly? Do you really want to have an operation like " go back to the previous step "? In IDEA, there is an opportunity to help you roll back the code.
But this fallback is not a panacea. For example, the following sequence structure cannot be rolled back.
void test() {
int a = 1;
int b = 2;
int c = a + b;
System.out.println(c);
}
When you setp into a function, you can see the Drop Frame icon. Rrop Frame refers to the statement that returns to the previous function.
source:
Set Value
Modify the value. When you need to continuously test whether the output of a function is correct when it has different inputs, you can use it with Rrop Frame to continuously test the result of a function .
source:
https://www.cnblogs.com/acm-bingzi/p/debugModifyValue.html
test code
import java.util.Scanner;
/**
* T
* m n
*/
public class Test3 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextInt()) { // 注意 while 处理多个 case
int t = in.nextInt();
String[] results=new String[t];
for (int t0 = 0; t0 < t; t++) {
int m = in.nextInt();
int n = in.nextInt();
String[][] ms = new String[m][m];
for (int j = 0; j < m; j++) {
for (int i = 0; i < m; i++) {
ms[j][i] = in.next();
}
}
String[][] ns = new String[n][n];
for (int j = 0; j < n; j++) {
for (int i = 0; i < n; i++) {
ns[j][i] = in.next();
}
}
String result = process(m, n, ms, ns);
results[t0]=result;
}
for (String result : results) {
System.out.println(result);
}
}
}
private static String process(int m, int n, String[][] ms, String[][] ns) {
boolean eq = true;
int c = m - n;
for (int i = 0; i <= c; i++) {
for (int j1 = 0; j1 < n; j1++) {
for (int i1 = 0; i1 < n; i1++) {
String n1 = ns[j1][i1];
String m1 = ms[j1 + i][i1 + i];
boolean eq1 = m1.equals(n1);
eq = eq && eq1;
if(eq){
continue;
}
}
}
if(eq){
break;
}
}
if (eq) {
// System.out.println("Yes");
return "Yes";
} else {
return "No";
// System.out.println("No");
}
}
}