Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get ip address

import java.awt.*;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

class Main
{
  public static void main(String args[]) throws IOException
  {
    InetAddress ip;
	String hostname;
	ip = InetAddress.getLocalHost();
	hostname = ip.getHostName();
    System.out.println("Current IP address : " + ip + "
" +
                "current Hostname : " + hostname);
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java read lines from file 
Java :: Java program to find the sum of first 100 numbers 
Java :: java print text with variables 
Java :: font parameters java 
Java :: spigot how to kill player 
Java :: android get text from string xml programmatically 
Java :: kill all java processes linux 
Java :: Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema 
Java :: What is a point class in java? 
Java :: turn ascii into text javascriot 
Java :: sum of 1D array(JAVA) 
Java :: sort list of string lexicographically java 
Java :: iterating over a hashmap 
Java :: read integer input java 
Java :: java get variable from another class 
Java :: how to add elements in array in java using for loop 
Java :: java code samples 
Java :: why java platform independent 
Java :: android check if app is running 
Java :: byte array to base64 string 
Java :: getting the last value of an integer in java 
Java :: spigot send player action bar message 1.8 
Java :: how to find the sum of an array in java 
Java :: how to acces every char of a String in java 
Java :: java stream get list of one field 
Java :: kmp java 
Java :: java to check if its a number scanner 
Java :: thread 
Java :: modal css react 
Java :: java insert char in string at index 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =