0

Java code problems

public class MyClass{ public int DollarsCost(String carModel){ if(carModel == "BMWX6") this.price = 100000; if(carModel == "AUDIA8") this.price = 250000; if(carModel == "MERCEDES-BENZAMG63S") this.price = 200000; else this.price = defaultPrice; } private int price; private const int defaultPrice = 0; } Don't pay attention to whole code, just wanted to ask about this line: private const int defaultPrice = 0; How do i write it correctly in java?

20th Sep 2018, 6:31 PM
Oleg Storm
Oleg Storm - avatar
2 ответов
+ 3
do you mean a constant int? private final int GREAT_LETTERS = 0;
20th Sep 2018, 6:52 PM
Daniel (kabura)
Daniel (kabura) - avatar
+ 1
private final int default_price = 0
20th Sep 2018, 7:27 PM
Dlite
Dlite - avatar