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呢?公共靜態雙重方法?