Networking in java{ How get IP Address Any website } - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Networking in java{ How get IP Address Any website }

Networking in java{ How get IP Address Any website }

// IPAddress of a website
import java.io.*;
import java.net.*;
class Address
{
public static void main(String[]arr)throws IOException
    {
    // accept name of the website from keybord
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in) );
    System.out.println("Enter the website name:");
    String site= br.readLine();
    try{

    // getByName() method accepts site name and return its IP address
    InetAddress ip=InetAddress.getByName(site);
    System.out.println("The IP Address is"+ip);
}
catch(UnknownHostException ue)
{
System.out.println("website not found");
}    }
}


About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.