Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Mengambil IP Pada PC

Menggunakan Bahasa Pemrograman Java


Oleh :
M. Rizki Adji Jaya
(061130701306)
6CD
JURUSAN TEKNIK KOMPUTER
POLITEKNIK NEGERI SRIWIJAYA
PALEMBANG
import java.net.*;
public class AmbilIP{
public static void main(String[]arg){
try{
InetAddress ip =
InetAddress.getByName("Localhost");
System.out.println(ip.getHostAddress());
System.out.println(ip.getHostName());
}
catch(UnknownHostException e){
System.out.println(e);
}
}
}

You might also like