Code example for UnknownHostException

Methods: getMessage

0
		String ip = null;
		try{ 
		      InetAddress IP = InetAddress.getLocalHost();
		      ip = IP.getHostAddress();
		    }catch (UnknownHostException e){
		      System.out.println("Exception caught while getting my ip ="+e.getMessage());
		    } 
		return ip;
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE