No write permission while editing in VI editor for /etc/hosts

In lab environment there is no write permission to edit the /etc/hosts. I tried to change its permission but nothing happen

Later I tried with sudo then it runs properly :>> sudo vi etc/hosts

You can use sudo with any command needs permissions to run like you did to edit in /etc/hosts.

sudo vi etc/hosts