所以,我知道有很多人遇到过这个问题并且有很多问题,但是我无法为此找到解决办法,我尝试执行其他所有工作,但这并不是什么问题。我无法弄明白为什么......
package prob3;
公共类LargestPrimeFactor {
double num = 600851475143D;
double LargestPrimeFactor;
public void getLargestPrimeFactor(String [] args){
double prevPrimeFactor = 0;
do {
for(double i = 0; i < num/2; i++){
if((num % i == 0) && (num / i != 1)){
prevPrimeFactor = num;
LargestPrimeFactor = num / i;
} else {
continue;
}
}
} while(prevPrimeFactor != LargestPrimeFactor);
System.out.println("The biggest prime factor of " + num + " is " + LargestPrimeFactor);
}
}
答案 0 :(得分:0)
你应该定义一个运行程序的主函数。类似的东西:
public static void main(String[] args) {
getLargestPrimeFactor(args);
}