Every developer used an example domain before. Whether it was one of IANA's official example TLDs (e.g. example.com, example.org), private ones (e.g. yourname.xyz) or even whole suffixes (e.g. .local, .dev).
There is nothing wrong with using these official domains, however, just as long as you stick to them.
Once you start drifting away from these standards, things could get ugly.
Google, for example, forgot to renew some of their domains used in their official help articles to represent its client domains. Somebody could have registered them and, worst case, redirect customers to a phishing site or similar. 
Privately owned example domains like beispiel.de may currently look like example domains, but could also be misused to redirect curious people to malicious sites. That's why I registered yourname.xyz, after being used in hundreds of examples. At that time, nobody thought there will ever be a .xyz top level domain. 
TL;DR - Stick to official example domains.