package myfirstclass;
import java.io.IOException;
public class MyFirstClass {
public static void main(String[] args) throws IOException {
Car RedCar;
RedCar = new Car();
RedCar.carColor = "red";
RedCar.milesPerGallon = 25;
RedCar.numDoors = 2;
Car BlueCar = new Car();
BlueCar.carColor = "blue";
BlueCar.milesPerGallon = 50;
BlueCar.numDoors = 4;
System.out.println("Choose a car...");
int read = System.in.read();
if(read == 1){
System.out.println("Hello, and your car is...");
System.out.println("Red!");
}
}
}
After I input a number, such as 1, it just says "Build Successful!", why is this? And how can I fix it to make sure it reads my input and follows the "if" statement correctly.
Thanks!