Q. Write a Java progarm in order to check the MAC Address of your system.

Ans. 

import java.io.*;  
import java.net.*;

public class mac 
{
public static void main(String[] args)  
 

  InetAddress ip;
  try {
   ip = InetAddress.getLocalHost();
   System.out.println("IP address : " + ip.getHostAddress());
   NetworkInterface network = NetworkInterface.getByInetAddress(ip);
   byte[] mac = network.getHardwareAddress();
   System.out.print("MAC address : ");
   StringBuilder sb = new StringBuilder();
   for (int i = 0; i < mac.length; i++)
  {
    sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
   }
   System.out.println(sb.toString());
  }
   catch (Exception e)
  {
   e.printStackTrace();
  }
 } 
}

Output: 

javac mac.java (//enter)
java mac (//enter)

IP address : 192.168.1.108
MAC address : 80-88-E2-02-C0-2F
 

mac address, mac foundation
Free picture downloaded from unsplash.com