Answers for "import java.net.InetAddress;"

3

InetAddress

System.out.print("Insert HostName: ");
        Scanner input=new Scanner(System.in);
        String host=input.nextLine();
        try{
            InetAddress ip=InetAddress.getByName(host);
            System.out.println(ip);
            if(ip.isReachable(50)){
                System.out.println("Destination Reached");
            }
            else{
                System.out.println("Destination Unreachable");
            }
        }
        catch (Exception e){
            System.out.println("Invalid domain");
        }
Posted by: Guest on June-23-2020

Code answers related to "import java.net.InetAddress;"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language