public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Insert value for year (Ez = 2014): ");
double year = in.nextDouble();
System.out.println("Insert value for day (Ex = 12): ");
double day = in.nextDouble();
System.out.println("Insert number for month (Ex = 3): ");
double month = in.nextDouble();
double totalDays = day;
if (month == 1) {
} else if (month == 2) {
double totalDays = (totalday + 31);
}
}
我想取totalDays
double並在if語句中使用它。我想添加一個變量而不再使用雙打。怎麼樣?如何添加一個雙變量只使用一個雙重
你是什麼意思我想用一個變量添加它,而無需使用了一倍? – 2014-09-23 23:32:40
這裏有沒有必要的「雙」? ''int''好像是一個更好的選擇 – 2014-09-23 23:33:46
爲什麼0月1月?爲什麼每月31天?也許28? – 2014-09-23 23:36:42