When using the FTC® SDK, there are a variety of built in hardware classes which can be used to communicate with hardware on the robot such as DC Motors, Servos, and Sensors.
The first thing required to properly create an object is to import its class. In Android Studio, if the class is referenced without being imported Alt+Enter can be pressed to automatically import it. After it is imported, the next step is to create the object:
private DcMotor liftMotor;
After the object is created, it must be instantiated. Part of the OpMode superclass is something called hardwareMap. hardwareMap is used in the FTC SDK to instantiate objects rather than calling a constructor.
It contains all of the information entered into the configuration on the Robot Controller, such as names of hardware and what port it is plugged into. Here is an example of instantiating the motor we created above:
liftMotor = hardwareMap.get(DcMotor.class, "Lift Motor");
Whatever sensor you are using, you will pass that class into the spot where DcMotor.class is. For example, if liftMotor was a Servo, Servo.class would be passed instead.
For the second argument, you pass whatever the device is named in the Robot Controller configuration. hardwareMap will then go find what port the device with that name is plugged into, which allows the hardware to be accessed.