例如:
考慮一個CustomerOperationClass類和一個常量變量regularCustomerDiscount,在它里面:
public class CustomerOperationClass { static final Double regularCustomerDiscount = 0.1; static Double finalPrice = 0; public static Double provideDiscount (Integer price) { //calculate the discount finalPrice = price - price*regularCustomerDiscount; return finalPrice; } }
要查看上述類的Output,您必須在開發(fā)人員控制臺匿名窗口中執(zhí)行以下代碼:
Double finalPrice = CustomerOperationClass.provideDiscount(100); System.debug('finalPrice '+finalPrice);
更多建議: