Search Here

Java program to print the address and names of the local machine and two well-known internet websites


/* Display the address and names of the local machine and two well-known websites */
import java.net.*;
class Websites
{
 public static void main(String args[]) throws UnknownHostException
 {
  InetAddress Adrs = InetAddress.getLocalHost();
  System.out.println("\n\t\tLocal Host Name & Address : "+Adrs);
  System.out.println();

  Adrs = InetAddress.getByName("facebook.com");
  System.out.println("\t\tFacebook Address          : "+Adrs);
  System.out.println();
  
  Adrs = InetAddress.getByName("google.com");
  System.out.println("\t\tGoogle Address            : "+Adrs);
  System.out.println();
 }
}

JAVA program to print the address and names of the local machine and two well-known internet websites
Output

No comments:

Post a Comment