我制作了一个在控制台上运行的简单 java 程序,但我遇到了以前从未遇到过的错误。我的代码中没有错误,但由于某种原因,我无法运行我从未使用过的“公共类系列”的程序。
这是我的代码:
import java.math.BigInteger;
import java.util.Scanner;
public class serie {
public final void main(String[] args) throws Exception {
final int BASE = 36;
final BigInteger MODULO = new BigInteger("ZV", BASE);;
Scanner keyboard = new Scanner(System.in);
String strChassisNummer;
String input = "y";
while (input == "y"){
try{
System.out.print("Geef een chasis nummer in:");
strChassisNummer = keyboard.nextLine();
BigInteger chassisNummer = new BigInteger(strChassisNummer,
BASE);
BigInteger remainder = chassisNummer.remainder(MODULO);
System.out.print(strChassisNummer);
System.out.print(";");
String paddedRemainder = remainder.toString(BASE);
if (paddedRemainder.length() == 1)
{
System.out.print("0" + paddedRemainder.toUpperCase());
}
else
{
System.out.print(paddedRemainder.toUpperCase());
}
System.out.println();
System.out.print("Wenst u nog een chasis nummer in te geven ? (y/n): ");
input =keyboard.nextLine();
if (input != "y"){
break;
}
}
catch (Throwable t){
t.printStackTrace();
}
}
}
}
提前致谢 !