If you want to play Minecraft with friends who own other systems, your best bet is to buy Minecraft: Bedrock Edition. The Bedrock version has cross-play, meaning you can play with a friend even if you're on PC and they're on a Nintendo Switch, for example. The Java version only allows you to play with other Java users.