In more detail
It usually arrives through Phishing attachments, malicious downloads or unpatched vulnerabilities. Ransomware encrypts files and demands payment; a trojan poses as something useful; spyware watches silently. Good habits: keep systems updated, install software only from trusted sources, keep offline backups and run reputable security software.