import java.util.Scanner;
public class test {
private static int number1 = 100;
private static int number2 = 1;
public static double avgAge() {
return (number1 + number2) / 2;
}
public static void main(String[] args) {
System.out.println("Average number: " + test.avgAge());
}
}
为什么 test.avgAge() = 50.0 而不是 50.5?有没有办法输出 50.5 代替?