实在想不通了,问问各位大侠。关于InetAddress类的 用InetAddress.getByName()不就行了嘛,想那么复杂干嘛 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 现在就是不能用getByName,只能用getByAddress 如下程序运行起来是没有问题: public static void main(String[] args){ byte[] address = new byte[4]; address[0] = (byte)211; address[1] = (byte)68; address[2] = (byte)32; address[3] = (byte)4; try{ InetAddress school = InetAddress.getByAddress(address); System.out.println(school.getHostName()); } catch(UnknownHostException e){ System.err.println("Shit"); } }关于这个byte的问题,大家看看InetAddress的SRC,在代码中能够找到答案比如:如果那一个byte是负数,则加上256,如果不是则就为本身当然JDK中不是这样实现的 String sIP = socket.getInetAddress().getHostAddress();//this sIP is "d%.d%.d%.d%"; 子类创建实例时调用父类构造函数的问题 java应用界面美化问题!! 关于类加载问题 java中获取MAX_VALUE equals的问题 window.top iframe使用例子 给各位出一道小题目:) [news]IBM计划收购Rational Exception in thread "main" java.lang.NoSuchMethodError: main 找不到类怎么回事? 关于二级菜单的问题 谁能帮我解释一下:类中为什么还要声明本类的引用(详情见内)
public static void main(String[] args){
byte[] address = new byte[4];
address[0] = (byte)211;
address[1] = (byte)68;
address[2] = (byte)32;
address[3] = (byte)4;
try{
InetAddress school = InetAddress.getByAddress(address);
System.out.println(school.getHostName());
}
catch(UnknownHostException e){
System.err.println("Shit");
}
}
关于这个byte的问题,大家看看InetAddress的SRC,在代码中能够找到答案
比如:
如果那一个byte是负数,则加上256,如果不是则就为本身
当然JDK中不是这样实现的
//this sIP is "d%.d%.d%.d%";