我在Pom.xml文件中设置了它以排除声纳扫描,但它不起作用。有没有语法问题?
任何人都可以帮忙解决这个问题吗?
import java.util.Scanner;
public class QiftPositivCount {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
final int SENTINEL = -9999;
int temp;
int x = 0;
int count = 0;
do {
System.out.print("Type numbers (-9999 to end) : ");
if((temp = scan.nextInt()) == SENTINEL){
break;
}else {
x = temp;
count++;
}
} while (temp != SENTINEL); // not really needed as you have the break statement
if (count == 0) {
System.out.println("You didnt type any number");
} else {
System.out.println("There are " + count + " numbers typed , and the numbers that fulfill the conditon are "
+ CountQiftPositiv(x)); // This was sending -9999 which will always evaluate to false in the function
//poz will stay at 0 the entire time
}
}
private static int CountQiftPositiv(int nr) {
int poz = 0;
//if(nr % 6 && nr > 0){
if (nr % 2 == 0 && nr % 3 == 0 && nr > 0) {
poz++;
}
return poz;
}
}
答案 0 :(得分:0)
exclusions
和结束>
之间有一个空格。删除它。**S**rc
的{{1}} 答案 1 :(得分:0)
这就是我的方式。
<sonar.exclusions>
src/main/java/com/bean/**,
src/main/java/com/response/**,
src/main/java/com/filter/**,
src/main/java/com/constants/**
</sonar.exclusions>