執行 ❯
獲取您
自己的Java
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
public class Main { public static void main(String[] args) { // Create variables of different data types int items = 50; float costPerItem = 9.99f; float totalCost = items * costPerItem; char currency = '$'; // Print variables System.out.println("Number of items: " + items); System.out.println("Cost per item: " + costPerItem + currency); System.out.println("Total cost = " + totalCost + currency); } }
物品數量:50
單件價格:9.99美元
總價 = 499.50美元