Different Outputs_networking
import java.net.*;
class check {
public static void main(String args[])throws Exception {
InetAddress address=InetAddress.getLocalHost();
System.out.println(address);
}
}
Now the first output is when i am connected to internet开发者_JAVA百科 and second output is when i am not connected to internet. What type of ip address is the second one? (the one encapsulated in InetAddress with internet not working)
Please help me in this.
127.0.0.1 is the loopback address. It's always present on your computer. When you don't have an externally accessible IP assigned to your machine, that's your local address.
127.0.0.1 is the canonical loopback address, in short, it's an always-available address of your own machine.
Actually, just googling this address brings relevant info instantly.
127.0.0.1 is the default loopback address of any machine when its no assigned particular ip
精彩评论