In this section we cover and explain Local Machine Host Name in details for freshers and experienced
previous | Home | Next |
Example
import java.net.*; class Myname { public static void main (String args[]) { try { InetAddress address = InetAddress.getLocalHost(); System.out.println("Hello " + address.getHostName()); } catch (UnknownHostException e) { System.out.println("Hi"); } } }
previous | Home | Next |