Static Mesh doesn't have material?

sorry for asking this n00b question, but I couldn’t find my answer online.

basically I want to add a static mesh to my game scene which uses a customized material I created with c++ code.

but when I add a static mesh through the green button “add component”, the static mesh doesn’t have “material”.

but those static meshes generated with game project template all have materials.

how can I add a material to my mesh?

do you have a c++ example of programmatically add meshes and materials to an empty Actor class?

As far as in editor adding a material to a mesh, if you go to your mesh in the content browser and double click it, it should bring up the mesh in a viewport and LOD0 in the details pane to the right. You should be able to set the material for your mesh there.