7 Mei 2018

Hasil Analisis #TugasPemrogramanJaringan



1. Mendapatkan alamat IP Local


Listing


import java.net.*;
public class getIP {
public static void main(String args[]) throws Exception {
InetAddress host = null;
host = InetAddress.getLocalHost();
byte ip[] = host.getAddress();
for (int i=0; i<ip.length; i++) {
if (i > 0) {
System.out.print(".");
}
System.out.print(ip[i] & 0xff);
}
System.out.println();
}

}
 

My university

Blogroll