我正在使用6.1版本的PrimeFaces社区。使用从PrimeFaces selectoneradio页面复制的以下代码,我尝试将所有选择发送出去,并且没有给出任何错误。当我将版本升级到7.0时,它给出了错误,要求true必须正常工作,但是我必须保留6.1版本。
在PrimeFaces 6.1上,此场景有任何错误吗?还是在PrimeFaces 6.1上有其他用途可达到我的目的?
import java.util.Scanner;
public class TestEquation {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
QuadraticEquation Quadratic = new QuadraticEquation();
System.out.println("Please enter the values of the following variables: ");
System.out.println("a: ");
Quadratic.setA(input.nextDouble());
System.out.println("b: ");
Quadratic.setB(input.nextDouble());
System.out.println("c: ");
Quadratic.setC(input.nextDouble());
if (Quadratic.getDiscriminant() < 0) {
System.out.println("The equation has the following roots:");
System.out.println("The first one is " + Quadratic.getRoot1());
System.out.println("The second one is " + Quadratic.getRoot2());
}
else if (Quadratic.getDiscriminant() == 0) {
System.out.println("The equation has one root:");
System.out.println(Quadratic.getRoot1());
}
else {
System.out.println("The equation has the no real roots");
return;
}
}
}