[4724] in java-interest

home help back first fref pref prev next nref lref last post

Re: misplaced method

daemon@ATHENA.MIT.EDU (Jim Graham)
Thu Jan 11 16:21:45 1996

Date: Thu, 11 Jan 1996 11:49:23 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: elliotte@blackstar.com
Cc: java-interest@java.Eng.Sun.COM


> > This should work:
> > 
> >  byte addr[] = {129, 144, 86, 116};
> >  String host = new InetAddress(null, addr).getHostName();
> > 
> 
> This fails because there's no constructor matching InetAddress(null, 
> byte array) in java.net.InetAddress. In fact there are no 
> constructors in there at all. (You also need to cast those ints to 
> bytes but that's easuily done.)

You're right.  "null" by itself doesn't have a type.  Try casting it
to a String:

	String host = new InetAddress((String) null, addr).getHostName();

or:

	String nullhost = null;
	String host = new InetAddress(nullhost, addr).getHostName();

				...jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post