What will be the output of the following Java program?
import java.net.*;
class networking
{
public static void main(String[] args) throws UnknownHostException
{
InetAddress obj1 = InetAddress.getByName("example.com");
InetAddress obj2 = InetAddress.getByName("example.com");
boolean x = obj1.equals(obj2);
System.out.print(x);
}
}
import java.net.*;
class networking
{
public static void main(String[] args) throws UnknownHostException
{
InetAddress obj1 = InetAddress.getByName("example.com");
InetAddress obj2 = InetAddress.getByName("example.com");
boolean x = obj1.equals(obj2);
System.out.print(x);
}
}
B. 1
C. true
D. false
Answer: Option C
Join The Discussion