Main.java:3:Holeintext 类是公共的,应在名为 Holeintext.java 的文件中声明 public class Holeintext { ^ 注意:Main.java 使用或覆盖了已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。1 个错误
这是错误我得到这是一个编译错误有人可以告诉我如何解决这个问题。请帮忙。在我的电脑上编译时,它运行时没有任何错误,但是当我将它上传到现场进行编译时,它会显示这个错误。
代码是:
package holeintext;
import java.io.*;
class Holeintext {
public static void main(String[] args) throws Exception {
// TODO code application logic here
DataInputStream in = new DataInputStream(System.in);
String s;
char[] str;
System.out.println("INPUT:");
int c = Integer.parseInt( in .readLine());
String[] str1 = new String[c];
for (int m = 0; m < c; m++) {
s = in .readLine();
str1[m] = s; //at this point we have a array with our input
}
System.out.println("OUTPUT:");
for (int g = 0; g < str1.length; g++) {
s = str1[g];
str = s.toCharArray();
int i = 0;
int count = 0;
while (i < str.length) {
if ((str[i] == 'A') || (str[i] == 'D') || (str[i] == 'O') ||
(str[i] == 'P') || (str[i] == 'R')) {
count = count + 1;
} else
if (str[i] == 'B') {
count = count + 2;
}
i++;
}
System.out.println(count);
}
}
}