import java.net.*;
import java.io.*;
public class iplocalmac
{
public static void main(String args[]) throws Exception
{
InetAddress ipadd =InetAddress.getLocalHost();
System.out.println("Host and Address :"+ipadd);
System.out.println("Host name :"+ipadd.getHostName());
String n=ipadd.toString();
System.out.println("IP address :"+n.substring(n.indexOf("/")+1));
}
}
In C/C++ a semicolon is used to terminate the statement.But if,while,switch(conditional constructs) do not require a semicolon to terminate.So if we use the printf statement inside these conditional constructs,then we do not require any semicolon to terminate the statement.
Comments
Post a Comment