Masturbating or sex

Can I Masturbate or have sex while pregnant??