FILLET RADIUS ZERO
A quick way to trim and join or extend and join two polylines is to use fillet. Fillet is most often used to create a curve with a specified radius between two lines, but has a little-known powerful use. If you set the radius to zero (which is the default when it is first called to use after starting AutoCAD), you can select near the end of the two lines you want to join and they will become one continuous polyline.
In the image below, all lines are polylines. If standard lines are used, the fillet will function the same, but the lines will retain their individual properties (i.e. stay the same color, not change to match the first-selected line).
In the Command Line, type FILLET (enter). The default radius is zero, so you can begin here. If you have been using fillet already, type R (enter) and 0 (enter). Click as indicated in the following image. Fillet has to be restarted to move on to the next set of lines.
The last image shows the results. The lines on the left are now joined and cyan since the cyan polyline was the first selected. On the right, they are white since the white polyline was the first selected. If these had been lines instead of polylines, they would be extended and trimmed, but would have retained their original colors and would not be joined.