Added protected cast

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2017-04-19 15:07:54 +02:00
parent f400ce9eb2
commit 49879b57f5

View File

@ -267,7 +267,7 @@ public class Main {
estate.setCity(FormUtil.readString("City"));
estate.setSquareArea(FormUtil.readInt("Square Area"));
if(estate instanceof Apartment){
if (estate instanceof Apartment) {
Apartment apartment = (Apartment) estate;
apartment.setFloor(FormUtil.readInt("Floor"));
apartment.setRent(FormUtil.readInt("Rent"));
@ -277,8 +277,8 @@ public class Main {
input = FormUtil.readString("Built-in Kitchen(Y/N)");
apartment.setBuiltinKitchen(input.equals("Y") || input.equals("y"));
}
else{
House house = (House)estate;
else if (estate instanceof House){
House house = (House) estate;
estate.setCity(FormUtil.readString("Name"));
estate.setPostalCode(FormUtil.readString("Postal Code"));