InetAddress Error
996701Mar 13 2013 — edited Mar 13 2013I'm a newbie , and I've short program:
------------------------
import java.net.*;
public class timdcIP {
public static void main(String[] args){
try{
if(args.length!=1){
System.out.println("Searching IP Addresss: ");
}
InetAddress host= new InetAddress.setByName(args[0]);
String HostName=host.getHostName();
System.out.println("HostName : "+ HostName);
System.out.println("IP Address : "+ host.getHostAddress());
}catch(UnknownHostException e){
System.out.println("Can't search IP Address");
return;
}
}
}
------------
And the Error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
InetAddress.setByName cannot be resolved to a type
at timdcIP.main(timdcIP.java:10)
Please help me to fix this problem. Thank you very much!