Help with push button tutorial- odd result

I have a question regarding the 'button' Arduino tutorial.

After setting both button PIN (e.g. PIN 2) and LED output PIN, you can disconnect the button and all the circuitry, yet still manage to light the LED by touching the button PIN (no. 2 in this case) with a conductor, such as a jumper wire. It stays on for a couple of seconds. Any idea why this is?

The impedance of an input pin is very high. An open input can do anything.

Try turning on the pin2 internal pullup resistor:

pinMode (pin2, INPUT);
digitalWrite (pin2, HIGH); // turns on internal pullup

Should see more consistent results.

Krodal:
The impedance of an input pin is very high. An open input can do anything.

Its extremely high in fact, can be millions of times higher than anything else in the circuit! A CMOS input behaves rather like an electroscope and responds to ions in the air landing on it, stray capacitance to any conductor nearby, etc. The condition is known as "floating" and is because CMOS transistor gates are insulated by silicon dioxide layers that are near perfect insulators. The input is voltage controlled so no current is needed.

In a microcontroller the pin also has an output stage driving it - when this is off there are back-to-back pn-junctions which have a high resistance too (though not as high as an input-only pin) - hence the LED only staying on for 2 seconds (rather than minutes/hours).