//package com.nowjava;
import java.net.InetAddress;/*N o w J a v a . c o m 提 供*/
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
getAddress();
}
public static void getAddress() throws UnknownHostException {
String defaultCharsetName = Charset.defaultCharset().displayName();
System.out.println("defaultCharsetName:" + defaultCharsetName);
InetAddress address = InetAddress.getLocalHost();
System.out.println(address.getHostName());
System.out.println(address.getHostAddress());
/*
from n o w j a v a . c o m - 时 代 Java
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。