With changing hosts file, you can mapping specific hostname to point to your own ip address, or let hostname to point to specific ip address at your current computer. For example, I want dev-mysite.com to point to my local machine will be following.
Another example, I want to google.com host name to point to ipaddress xxx.xxx.xxx.xxx
Following are comment from Microsoft.
This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol.
after you changed hostname to point to specific ip address, you might have to type
ipconfig /flushdns at command line.