IMPORTANT: READ MY DISCLAIMER AT THE END
The landing gear is an amazing system built to take the stress of landing and handle side loads while turning. A retractable landing gear is even more amazing because it also has the ability to fold up into the plane and reduce drag.
The landing gear is controlled with a simple up and down handle. But what happens if you put the handle in the up position while parked on the ground?
Nothing! Modern gear systems are built to not be retractable on the ground. In most cases, they use something called a squat switch. This is just a button on one leg of the landing gear.
When a plane is on the ground, it’s weight pushes down on the landing gear and compresses the strut. However, as a plane takes off, the weight is off the gear so the strut extends. As it extends a metal plate pushes against the squat switch button.
When this button is not pressed, the plane is known to be on the ground and the landing gear system will not operate. This simple system gives an added layer of safety in avoiding the expensive and potentially dangerous results of a landing gear retraction on the ground.
DISCLAIMER: NEVER put your gear handle in the up position on the ground. Other problems may exist that would cause it to retract. This is a dumb and costly way to test your squat switch. Instead, visually inspect your squat switch as part of your preflight and if you are concerned take it to a mechanic.