Disqus Shortname

Pemrograman Jaringan Dengan Java (whois)

Menampilkan IP

import java.net.*;
public class whois{
public static void main(String args[]){
if(args.length == 0){
System.out.println("Pemakaian : java IPtoName <IP Address>");
System.exit(0);
}
String host = args[0];
InetAddress address = null;
try{
address = InetAddress.getByName(host);
}catch(UnknownHostException e){
System.out.println("invalid IP");
System.exit(0);
}
System.out.println(address.getHostName());
}
}


Hasil Program :


Tidak ada komentar:

Diberdayakan oleh Blogger.