what changes should be applied on the code code: import java.net.*;import java.util.*;public class IPFinder { public s

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

what changes should be applied on the code code: import java.net.*;import java.util.*;public class IPFinder { public s

Post by answerhappygod »

what changes should be applied on the code
code:
import java.net.*;import java.util.*;public class IPFinder { public static void main(String[] args) { String host; Scanner input = new Scanner(System.in); System.out.print("\n\nEnter host name: "); host = input.next(); try { InetAddress address = InetAddress.getByName(host); System.out.println("IP address:" + address); System.out.println("Host Address:" + address.getHostAddress()); System.out.println("Is this Address Multicast? : " + address.isMulticastAddress()); // returns address in bytes System.out.println("IP Address in bytes : " + address.getAddress()); } catch (UnknownHostException uhEx) { System.out.println("Could not find " + host); } }}
import java.net.*;
import java.util.*;
public class IPFinder
{
public static void main(String[] args)
{
String host;
Scanner input = new Scanner(System.in);
System.out.print("\n\nEnter host name: ");
host = input.next();
try {
InetAddress address = InetAddress.getByName(host);
System.out.println("IP address:" + address);
System.out.println("Host Address:" + address.getHostAddress());
System.out.println("Is this Address Multicast? : "
+ address.isMulticastAddress());
// returns address in bytes
System.out.println("IP Address in bytes : "
+ address.getAddress());
}
catch (UnknownHostException uhEx)
{
System.out.println("Could not find " + host);
}
}
}
What Changes Should Be Applied On The Code Code Import Java Net Import Java Util Public Class Ipfinder Public S 1
What Changes Should Be Applied On The Code Code Import Java Net Import Java Util Public Class Ipfinder Public S 1 (55.96 KiB) Viewed 26 times
Enter host name: www.amazon.com IP address :www.amazon.com/54.192.1.31 Host Address : 54.192.1.31 Is this Address Multicast?: false IP Address in bytes : [B@ 42 a57993
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply