Are www.google.com and www.amazon.com the Same?

Are www.google.com and www.amazon.com the Same?

Program:

import java.net.*;

public class DiffClass {
public static void main (String args[]) {
try {
InetAddress a1 = InetAddress.getByName("www.google.com");
InetAddress a2 = InetAddress.getByName("www.amazon.com");
if (a1.equals(a2)) {
System.out.println("They are same..");
}
else {
System.out.println("They aren't the same..");
}
}
catch (UnknownHostException e) {
System.out.println("Host lookup failed.");
}
}
}












Output:

They  aren't same..




Share:

0 comments