public class Car {
int speed; // a field
// Constructor: same name as the class, no return type
public Car() {
speed = 40; // set a starting value
}
public static void main(String[] args) {
Car myCar = new Car(); // constructor runs here
System.out.println(myCar.speed); // Outputs 40
}
}