When 0-2 are not connected, but I place my finger close to arduino or just plug a wire into pin 2 , the LED starts flickering. any ideas why it could be happening?
And is case that makes you curious... this is not abnormal behavior. The presense of your finger is enough influence to cause the pin to change state. The is normally kept under control by holding the pin closer to one of the power rails (+5) or (GND) using a resistor... it doesn't have to be exact... but 10K ohms should be enough.
The human body has a number of electrical characteristics... including the ability to conduct AC currents (act like a lossy dielectric) which allows you to transmit noisy signals from your environment like a big antenna to your circuit. Those touch on/touch off lamp controls that have been around for years take advantage of this behavior.