I am trying to point a URL to a particular IP address.But the IP belongs to the domain and I want it to point to a subdomain belonging to that domain.I am doing this by altering the hosts file in the etc directory.So is it possible for me to do that?
Most likely: No.
The /etc/hosts file is like a local DNS-server. If your only concern is a local connection to the subdomain then it would work.
If you expect your visitors/users of your application to also see this subdomain entry, then it would not work as you expect.
You could then either visit everyone personally and alter their
/etc/hosts file. While this sounds funny, it might be a quick solution if you want your co-workers see a certain subdomain correctly.
The other, more global solution would be an entry in your Nameserver. If you don't have access to those (I don't), then see if your provider has some webinterface to configure that or ask them.
EDIT: Please note that the
/etc/hosts file is a simple mapping of domain-names to ip-addresses.