The number of kernels in the last conv layer (out_channels) will specify the number of classes, while the 1x1 kernel does not change the spatial size.
Using this approach you can easily output the class logits for each pixel location e.g. in a segmentation use case.