Packet switching is a technique used in computer networks where messages are divided into packets that contain header information with the destination. Each packet is routed independently through the network based on its header. There are two main approaches for packet switching: datagram packet switching treats each packet independently and routes them without maintaining connection state, while virtual circuit switching establishes a pre-planned route via a call setup before sending packets along a fixed path for the connection's duration.